2

My project uses Entity Framework 6 with Repository & UnitOfWork patterns to communicate with a MSSQL database. all configurations are done with Code First.

All of the navigation properties of the Entity Objects are defined for lazy loading as such:

public virtual ICollection<> Items  { get; set; }

this works well, and the performance is pretty good in most cases. in some cases, however, where the navigation properties refer to a large sets of data, loading them to memory takes a while, at which point LINQing seem like a bad practice. to improve performance, it would make sense to convert some of them to IQueryable<> but EF doesn't seem to accept that kind of configuration.

So although i could workaround this by "Querying" the repositories, in some cases i already have an entity object in memory and it feels right to be able to query its navigation properties without loading all of them, to get the data that i need via LINQ.

Is there a way to make this work?

1 Answer 1

0

You do not. This functionality is not available in Entity Framework. YOu can make a feature request. But right now - no way.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.