收藏 Entity framework(EF) Code First这用用法什么优点?实现IRepository接口?究竟有什么优点?

不懂必须要问 2013-03-30 04:05:07
这个文章

奇怪了,怎么实现IRepository,也是一样添加删除,有什么意思呢?不用如Object.Table.Add这种呢? 还要分了几层,这样的优点是什么?直接EDMX不比这个方便嘛?不明白。
...全文
307 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
不懂必须要问 2013-04-02
  • 打赏
  • 举报
回复
哎,不明白
  • 打赏
  • 举报
回复
Code First 先有模型 再有数据库表的 Code First也清晰了 代码简介很多
不懂必须要问 2013-04-02
  • 打赏
  • 举报
回复
引用 7 楼 winner2050 的回复:
不用edmx,你能开发什么东西? 你指望架构师,技术经理,项目经理,老板这样的人物,慢慢的给你写几百个表的结构代码? 然后又写几百个视图的结构代码?
但是每次都new一个DBContext出来,人多高峰期会不会挂掉?
winner2050 2013-04-02
  • 打赏
  • 举报
回复
不用edmx,你能开发什么东西? 你指望架构师,技术经理,项目经理,老板这样的人物,慢慢的给你写几百个表的结构代码? 然后又写几百个视图的结构代码?
不懂必须要问 2013-04-02
  • 打赏
  • 举报
回复
引用 5 楼 LaoWu_ 的回复:
我也不明白,并且由于功力不深,这几天用EF到处碰壁。甚是不爽。又不想用edmx。唉,纠结死了
貌似直接用EDMX好像次次都实例化一个,会不会慢,烦烦哦
_JeffreyWu 2013-04-02
  • 打赏
  • 举报
回复
我也不明白,并且由于功力不深,这几天用EF到处碰壁。甚是不爽。又不想用edmx。唉,纠结死了
机器人 2013-03-31
  • 打赏
  • 举报
回复
说白了就是分离出来,便于测试。 接口定下来了。数据库可以用假的模型代入。 http://blog.csdn.net/fangxinggood/article/details/7203212
threenewbee 2013-03-31
  • 打赏
  • 举报
回复
如果你觉得没有优点,那可能真的没有优点。没有放之四海而皆准的优点。任何为了某个需求而增加的概念都增加了复杂度。
不懂必须要问 2013-03-30
  • 打赏
  • 举报
回复
怎么说呢?怎么搞呢?EF越搞越乱套了啦?
Microsoft’s principal data access technology ADO NET Entity Framework has had two major releases as part of the NET Framework NET 3 5 brought us the first version of Entity Framework which is covered in the first edition of Programming Entity Framework In 2010 Microsoft NET 4 was released; it contained the next version of Entity Framework referred to as Entity Framework 4 The completely revised second edition of Programming Entity Framework was dedicated to teaching readers how to use this version of Entity Framework in Visual Studio 2010 When NET 4 was released the Entity Framework team was already hard at work on a new addition called Code First to provide an alternative to building the Entity Data Model that is core to Entity Framework Rather than using a visual designer Code First allows you to create the model from your existing classes This book is dedicated to teaching readers how to use Code First to build and configure a model based on the classes in your business domain While Code First can do much of the job of inferring a model from your classes there is quite a lot that you can do to affect the model that Code First creates In this book you will learn what Code First does by default aka convention and how to perform further configuration to affect how it understands your properties classes relationships and the database schema they map to whether you use Code First to help create a database or you want to use it with an existing database With this knowledge you can reap the benefits of the Entity Framework while leveraging existing classes or those classes you might be building for a new software project ">Microsoft’s principal data access technology ADO NET Entity Framework has had two major releases as part of the NET Framework NET 3 5 brought us the first version of Entity Framework which is covered in the first edition of Programming Entity Framework In 2010 Microsoft NET 4 was released; [更多]

62,039

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧