This project is read-only.

Sql Select

Jan 12, 2010 at 11:35 AM

Using the LinqRepository implementation I notice that when you retrieve an entity (or collection of entities) using "FindAll", "FindOne" etc, the generated sql command retrieves all fields for that entity.

Clearly this would be undesirable if the entity had many properties and the view model only needed one or two of them.

Is there a way to alter this behaviour to retrieve the few relevant fields?


Jan 18, 2010 at 9:04 AM

Looking at the discussions elsewhere in here re pagination, would one approach be to return the list of elements as an IQueryable instead of IList?

I guess how I would expect that to work, is that if I returned an IQueryable from the tasks layer and then mapped this to a view model, that NHibernate would only query for the columns at the point of performing the mapping.

However, would this still pull back all columns (even if they weren't all mapped to the view model)?