Quantcast
Channel: West Wind Message Board Messages
Viewing all articles
Browse latest Browse all 10393

Re: 'Where' queries in EFCodeFirst???

$
0
0
Re: 'Where' queries in EFCodeFirst???
West Wind Web Toolkit for ASP.NET
Re: 'Where' queries in EFCodeFirst???
Dec. 10, 2012
12:04 pm
3NX0PVBZAShow this entire thread in new window
Gratar Image based on email address
From:Rick Strahl
To:Matt Slay

Look at LoadBase( Expression )...

But... it's protected so it's meant to be used from inside of your business object, not from outside of it. Load type behavior should always be high level matching your business case, not generic. You should never have expression sytnax in your application level code with *maybe* the exception of query filtering (ie. IQueryable results that further get filtered by the app code).

+++ Rick ---



Rick - I see the basic Load() method in EfCodeFirst for fetching a record by ID.

However, can you please advise the correct usage of EfCodeFist to perform a "Where" query so we can pass in a match (lambda) criteria to return a collection of matching records?

Example:

var quotes = db.Quotes.Where(x => x.cust_num == "DNT001");

If we need this kind of query, are we supposed to drop back to native EF contexts and call per the above? Or is there a certain way we can make this call with your EfCodeFirst?



Rick Strahl
West Wind Technologies


from Maui, Hawaii

Making waves on the Web


Viewing all articles
Browse latest Browse all 10393

Trending Articles