开发者

entity framework v4 and wpf

Need some help or some advice with entity framework v4.

As you already know, EF v4 does not support lazy loading of scalar properties. If I have some entity object for example Order in model with many scalar properties, some of them expensive to load from DB, like attached file for example.

As I found later, it is possible to move these expensive properties to another entity for example Order1 and remap them to DB table. So original DB table will be mapped to 2 entities - Order - with properties ID and Name and Order1 - with all others.

What I need to do? In User Interface I will have a ListBox filled with entity Order (ID - Name of all orde开发者_StackOverflowrs) on left side and all other expensive properties of Order1 on right side for clicked order in listbox. Properties from Order1 lazy loaded, and with working savechanges, delete objects etc ... .

How to make business object for order as entities are separated and how to setup with wpf binding?

thanks


Having 2 models complicates your program, and can be a source of bugs. I would rather use a single model and then selectivily load items as I needed them.

I meant use only one entity framework model. Looks like you are doing this already. What you need to do in to explicitly load data when you need it, see http://msdn.microsoft.com/en-us/library/bb896249.aspx.

This is actually a design desision from MS, to force you to be aware of which data you need at which times. With automatic lazy loading it works, but then you can get into problems later due to scaling issues.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜