最佳实践建议 [英] Best Practice Advice

查看:80
本文介绍了最佳实践建议的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我在这里提供一些建议,因为我看到了很多相互矛盾的文章/建议,包括来自微软的东西。



在您看来,在创建用于数据输入和数据的表单(WPF / Winform)时,使用实体框架的最佳方法是什么?查看。



你应该:



a)在程序开始时创建一个实体上下文实例在整个应用程序中维护它吗?

b)只在需要读取数据,保存数据等时创建实例?



哪个做当你想要实现延迟加载和更改跟踪时,你觉得效果最好吗?



我用Google搜索了这个,并且阅读了各种文章,但没有一篇是明确的,所以我追求更多的意见,以便我最终可以做出自己的判断。



谢谢。

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.

Thanks.

推荐答案

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.


这篇关于最佳实践建议的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆