Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8555641
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T15:10:13+00:00 2026-06-11T15:10:13+00:00

Below is the code I am using and the database table it is pulling

  • 0

Below is the code I am using and the database table it is pulling from has about 92000 records in it. The way it is pulling right now it is pulling all 92000 records then doing the filtering.
What I am looking to do is the filtering on the initial pull from the DB so that it does not take aproximately 40 seconds to load the page.
This is something I am still new at so I am lost as to how to do this and make it work with my view

public ViewResult Makes()
{
    var items = (from item in DBCacheHelper.recallslist
                 orderby item.MFGTXT ascending
                 select item.ToDomainRecall()).GroupBy(item => item.MFGTXT).Select(grp => grp.First());


    return View(items);
}

public static IEnumerable<Recall> recallslist
{
    get
    {
        if (c["GetAllRecalls"] == null)
        {
            c.Insert("GetAllRecalls", GetAllRecalls());
            return (IEnumerable<Recall>)c["GetAllRecalls"];
        }
        else
        {
            return (IEnumerable<Recall>)c["GetAllRecalls"];
        }
    }
}



public static IEnumerable<Recall> GetAllRecalls()
{
    using (DealerContext context = new DealerContext())
    {
        var items = from item in context.recalls.ToList<Recall>()
                     select item.ToDomainRecall();
        return items.ToList<Recall>();
    }
}


SELECT 
[Extent1].[RecallsId] AS [RecallsId], 
[Extent1].[RECORD_ID] AS [RECORD_ID], 
[Extent1].[CAMPNO] AS [CAMPNO], 
[Extent1].[MAKETXT] AS [MAKETXT], 
[Extent1].[MODELTXT] AS [MODELTXT], 
[Extent1].[YEARTXT] AS [YEARTXT], 
[Extent1].[MFGCAMPNO] AS [MFGCAMPNO], 
[Extent1].[COMPNAME] AS [COMPNAME], 
[Extent1].[MFGNAME] AS [MFGNAME], 
[Extent1].[BGMAN] AS [BGMAN], 
[Extent1].[ENDMAN] AS [ENDMAN], 
[Extent1].[RCLTYPECD] AS [RCLTYPECD], 
[Extent1].[POTAFF] AS [POTAFF], 
[Extent1].[ODATE] AS [ODATE], 
[Extent1].[INFLUENCED_BY] AS [INFLUENCED_BY], 
[Extent1].[MFGTXT] AS [MFGTXT], 
[Extent1].[RCDATE] AS [RCDATE], 
[Extent1].[DATEA] AS [DATEA], 
[Extent1].[RPNO] AS [RPNO], 
[Extent1].[FMVSS] AS [FMVSS], 
[Extent1].[DESC_DEFECT] AS [DESC_DEFECT], 
[Extent1].[CONEQUENCE_DEFECT] AS [CONEQUENCE_DEFECT], 
[Extent1].[CORRECTIVE_ACTION] AS [CORRECTIVE_ACTION], 
[Extent1].[NOTES] AS [NOTES], 
[Extent1].[RCL_CMPT_ID] AS [RCL_CMPT_ID]
FROM [dbo].[Recalls] AS [Extent1]

Update:

Ultimately I would like to only pull records from the Recalls Table where the MFGTXT is equal to the
MakeName in the AutoMake Table

public class AutoMake
{
    [Key]
    public int MakeID { get; set; }
    public string MakeName { get; set; }

public AutoMake ToDomainAutoMakes()
{
    return new AutoMake
    {
        MakeID = this.MakeID,
        MakeName = this.MakeName
    };
}

}

public class Recall
{
    [Key]
    public int RecallsId { get; set; }
    public string RECORD_ID { get; set; }
    public string CAMPNO { get; set; }
    public string MAKETXT { get; set; }
    public string MODELTXT { get; set; }
    public string YEARTXT { get; set; }
    public string MFGCAMPNO { get; set; }
    public string COMPNAME { get; set; }
    public string MFGNAME { get; set; }
    public string BGMAN { get; set; }
    public string ENDMAN { get; set; }
    public string RCLTYPECD { get; set; }
    public string POTAFF { get; set; }
    public string ODATE { get; set; }
    public string INFLUENCED_BY { get; set; }
    public string MFGTXT { get; set; }
    public string RCDATE { get; set; }
    public string DATEA { get; set; }
    public string RPNO { get; set; }
    public string FMVSS { get; set; }
    public string DESC_DEFECT { get; set; }
    public string CONEQUENCE_DEFECT { get; set; }
    public string CORRECTIVE_ACTION { get; set; }
    public string NOTES { get; set; }
    public string RCL_CMPT_ID { get; set; }

    public Recall ToDomainRecall()
    {
        return new Recall
        {
            RECORD_ID = this.RECORD_ID,
            CAMPNO = this.CAMPNO,
            MAKETXT = this.MAKETXT,
            MODELTXT = this.MODELTXT,
            YEARTXT = this.YEARTXT,
            MFGCAMPNO = this.MFGCAMPNO,
            COMPNAME = this.COMPNAME,
            MFGNAME = this.MFGNAME,
            BGMAN = this.BGMAN,
            ENDMAN = this.ENDMAN,
            RCLTYPECD = this.RCLTYPECD,
            POTAFF = this.POTAFF,
            ODATE = this.ODATE,
            INFLUENCED_BY = this.INFLUENCED_BY,
            MFGTXT = this.MFGTXT,
            RCDATE = this.RCDATE,
            DATEA = this.DATEA,
            RPNO = this.RPNO,
            FMVSS = this.FMVSS,
            DESC_DEFECT = this.DESC_DEFECT,
            CONEQUENCE_DEFECT = this.CONEQUENCE_DEFECT,
            CORRECTIVE_ACTION = this.CORRECTIVE_ACTION,
            NOTES = this.NOTES,
            RCL_CMPT_ID = this.RCL_CMPT_ID

        };
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T15:10:14+00:00Added an answer on June 11, 2026 at 3:10 pm

    If you want to add server side filtering outside of your repository methods, you need to return your types as IQueryable rather than IEnumerable and not call .ToList, .AsEnumerable, or any other method that would cause .GetEnumerator to be called. Additionally, your cast `(IEnumerable)c[“GetAllRecalls”];’ forces LINQ to Objects to be used for subsequent requests rather than retaining the expression tree and using Entity Framework. That being said, you may need to move your call to ToDomainRecall method to after the additional filter is applied as well because that can’t be translated to your database. Here are some of the changes you would need to make:

    public ViewResult Makes()
    {
        var items = (from item in DBCacheHelper.recallslist
                     orderby item.MFGTXT ascending
                     select item.ToDomainRecall()).GroupBy(item => item.MFGTXT).Select(grp => grp.First());
    
    
        return View(items);
    }
    
    public static IQueryable<Recall> recallslist
    {
        get
        {  
            if (c["GetAllRecalls"] == null)
            {
                c.Insert("GetAllRecalls", GetAllRecalls(context));
            }
            return c["GetAllRecalls"];
    
        }
    }
    
    
    
    public static IQueryable<Recall> GetAllRecalls(DealerContext context)
    {
            var items = context.recalls;
            return items;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using the code below to display the records from my database in
Currently I am calling a title from the database using the below code it
I am using the script code below to get results from my database based
I was using the following code to retrieve HTML snippets from a database table
I have a very small script to get all records from a database table,
I am using the code below t programmatically restore a SQL database using VB.Net
I am trying to access an SQLite 3 database programmatically using the code below:
I am using below code to generate photo gallery from a folder. How can
I'm using below code to check some form fields and render datatable table on
I create a table in database using sqlalchemy and now want to make a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.