Entity Framework 4 - Delay loading expensive fields

I know this question was asked for Entity Framework 1, but now that Entity Framework 4 has come out and Microsoft claims to provide all the Linq capabilities for Sql + more, does Entity Framework support lazy loading of expensive properties? In Linq to Sql, this is very easy. There's a Delay Loaded option for any property (accessible via Designer) that can be simply turned on or off. Is there something like this in Entity Framework?

thanks

+2


a source to share


3 answers


I asked a question here on the MS EF forum. As you can see, they have provided a link to the description of Partitioning Tables in Entity Framework .

Basically the idea is to split one database table into multiple Entities that are linked in a 1: 1 relationship, and then benefit from the usual lazy loading function between related objects.



Not as convenient as the delayed-load-flag in LINQ to SQL, but at least a solution that doesn't require touching your database table.

Edit . Finally, MS support answered in the thread I linked above that "Delayed Load Flag" as in LINQ to SQL definitely does not exist in Entity Framework.

+1


a source


I tried the method of splitting tables. Works like a charm. Just create a second table with a key field and a blob field, an ono-to-one relationship to the original image table. Remove blob field from image table.

Update the model and create a link between the image class and the blob class.

When you really need a blob field, remember to "include" the blob table like this:



from a in dc.GeneralFile.include("Image").select(a => a.FileId, a.Image.Blob)  

      

Hope it works for you.

PS Tried to add an image but not allowed

0


a source


-1


a source







All Articles