views:

23

answers:

1

If I add properties onto a linq entity (employees for example), that simply refer to other properties to implement an interface, return an IQueryable, and the where clause mentions those added properties that just point to other linq entity properties, will it cause the entire table to be loaded and filtered in memory instead of at the sql server?

my database uses lower case fields, linq to sql pulls this in and wants to use lower case properties on the entity, I use resharper and prefer to stick to the convention of UpperCamelCase for public properties.

A: 

If the query in your property accepts IQueryable as a parameter and returns IQueryable, and there are no conversions to/from IEnumerable or ICollection before the return, the query will not be executed in the property. It will be extended, and the actual execution will occur at the moment of casting to IEnumerable etc.

Devart
my properties are a simple alias, for instance linq to sql has a field called ZAssociateId, to implement my IEmployee interface, I make a property in the partial class called AssociateId that simply returns the ZAssociateId. I'm not sure how to apply your answer to my use case.
Maslow