gpt4 book ai didi

c# - LINQ to SQL 或 Entities,在这一点上?

转载 作者:可可西里 更新时间:2023-11-01 08:38:23 24 4
gpt4 key购买 nike

我有点晚了,决定花一些业余时间学习 LINQ。作为练习,我将在 MVC 2 中重写一个 WebForms 应用程序(这对我来说也是新的)。我设法在这里找到了一些关于 LINQ 的主题(Learning about LINQBeginners Guide to LINQIs LINQ to SQL Dead or Alive?),这引起了我对实体与 SQL 的关注。

然而,这些线程都已有一年多的历史了,而且我似乎找不到任何关于哪种 ORM 更可取的明确信息。此时实体或多或少是 LINQ to SQL 2.0 吗?还是比较难用?

是否有任何理由使用 LINQ to SQL,或者我应该跳转到实体?我在现在的雇主那里编写的应用程序的生命周期很长(约 10 年),因此我正在尝试选择最好的可用技术。

最佳答案

在最近关于扩展 NerdDinner 的帖子中,Scott Hanselman谈到了这件事。最后引用:

Conclusion

There's lots of choices for Database Access on .NET. You'll run into DataReaders in older or highly tuned code, but there's no reason it can't be hidden in a Repository and still be pleasant to use. LINQ to SQL is nice, lightweight and fast and has dozens of bug fixes in .NET 4, but Entity Framework is the way they are heading going forward. Plus, Entity Framework 4 is way better than EF 3.5, so I'm using it for any "larger than small" projects I'm doing and I'm not having much trouble.

诚然,我还没有太多机会试用它,但 EF4 似乎确实赢得了许多专业人士的信任。

关于c# - LINQ to SQL 或 Entities,在这一点上?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2976512/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com