Click here to Skip to main content
15,881,757 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi guys,

I'm here for a bit of advice really as I have seen quite alot of contradictory articles/advice, including stuff from Microsoft.

In your opinion(s) what is the best way to use the entity framework when creating forms (either WPF/Winform) that are used for both data entry and data viewing.

Should you:

a) create an entity context instance at the start of the program and maintain it throughout the application?
b) Only create the instance as and when you need to read data, save data etc?

Which do you feel works best when you want to implement lazy loading and change tracking?

I have googled this, and read a variety of articles and none are definitive so I am after some more opinions so that I can make my own judgement at the end.


1 solution

One can not simply advice on this matter. I agree you get a lot of unwanted and confusing information over the net. The best thing you can do is read this book - "Programming Entity Framework IInd Edition by Julia Lerman". The rest depends on you. :-)

Note:This book is very good & very helpful. If you are going to use EF, then you have no other choice.
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900