views:

134

answers:

1

I'm using the DataLoadOptions to retrieve the User that modified a Customer's details,

DataLoadOptions dlo = new DataLoadOptions();
dlo.LoadWith<Customer>(c => c.ModifiedBy);

However, I only want the User's ID and FirstName and not all the columns. Is there a way to specify the columns you want in the DataLoadOptions?

Tables:

Customer (ID, FirstName, LastName, Email, ModifiedByUserID etc)
User (ID, FirstName, LastName, etc)
A: 

I don't think there's any way of specifying the columns to load with DataLoadOptions.

There is an DataLoadOptions.AssociateWith Method that allows you to limit the amount of data retrieved but this is in terms of records.

If this where possible, the system had to somehow know that a record was only loaded with a specified number of columns. When the not-loaded columns where requested in the future, Linq would have to fetch only these columns from the database. I don't think that Linq is capable of this.

bruno conde