Hi Jacobo,

It seems to me your problem has more to do with Entity Framework than F# and perhaps you'd be able to have a quicker solution through an EF forum.

Typical ORM will have lazy loading on collection properties. This is to ensure you do not pull the entire object graph from the database when you want a single entity. This is sometimes implemented by having a proxy class (automatically by the framework) that derives from your Product class and will automatically go to the database only once you access the property.

I do not know the details of Entity Framework as I am only familiar with NHibernate and LinqToSQL, but another possibility could be that your schema or wiring isn't done properly and your Categories property will therefore not load anything.

Good luck.

By on 3/28/2013 5:02 AM ()

This may not necessarily be an answer to your question, but you can always make a lazy sequence or query eager by evaluating it, e.g. either by converting the result to a non-lazy data structure like a list, or by calling the equivalent of .Count() on it.

By on 3/23/2013 1:08 PM ()

Hi Adam and thanks for helping,

Is what you say true for related entities? From my repository I receive a structure of type 'Product list'. On the code of my controller I've tried several things to force the list to what you said: converting it toSeq, toArray, creating a dummy value resulting from products.Length and then returning products (which is the value containing the collection from the repository). Nothing seems to work except explicitly doing the query in the repository with the Include methods in it to force the loading of those related entities.

Any guess what may I be doing wrong?

Thank you very much!

By on 3/24/2013 10:34 AM ()
IntelliFactory Offices Copyright (c) 2011-2012 IntelliFactory. All rights reserved.
Home | Products | Consulting | Trainings | Blogs | Jobs | Contact Us | Terms of Use | Privacy Policy | Cookie Policy
Built with WebSharper