对于电子商务网站来说,ORM 的最佳选择是什么?
我正在使用 C# 3.0 / .NET 3.5 并计划构建一个电子商务网站。
我见过 NHibernate、LLBLGEN、Genome、Linq to SQL、Entity Framework、SubSonic 等。
我不想手动编写所有代码。 如果存在一些特定的瓶颈,我将设法优化数据库/代码。
哪种 ORM 最好? 那天有太多可用的东西,我什至不知道从哪里开始。
我应该使用哪些功能?
欢迎链接、截屏视频和文档。
I am using C# 3.0 / .NET 3.5 and planning to build an eCommerce website.
I've seen NHibernate, LLBLGEN, Genome, Linq to SQL, Entity Framework, SubSonic, etc.
I don't want to code everything by hand. If there is some specific bottleneck I'll manage to optimize the database/code.
Which ORM would be best? There is so much available those day that I don't even know where to start.
Which feature(s) should I be using?
Links, Screencast and Documentation are welcome.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我一直在使用 nHibernate,这是一个非常好的免费解决方案。 一个缺点是缺乏文档,这会导致启动时间稍微陡峭。 但一旦掌握了基础知识,它确实会加快开发速度。
我喜欢 Fluent nHibernate,因为它提供了一种无需 xml 文件即可配置的方法。 我建议的一件事是从应用程序中抽象出数据访问。 这样,如果您选择错误,您不必担心重新编码应用程序层。
I've been using nHibernate which is a very good free solution. The one downside is the lack of documentation, which causes a slightly steep rampup time. But once you get the basics down it really speeds up development.
I like Fluent nHibernate for a way to configure without the xml files. The one thing I suggest though is to abstract out your data access from your application. this way should you choose wrong you don't have to worry about re-coding the App tiers.
我只能真正代表 LINQ-SQL 并且可以说它是:
但如果出现以下情况,它就会开始下降:
我想自己尝试一下 EF,MS 似乎正在悄悄放弃 LINQ-SQL,转而使用 EF,这并不是一个响亮的建议LINQ-SQL :)
I can only really speak for LINQ-SQL and can say that it is:
but it starts to fall down if:
I'm looking to try EF next myself and MS seem to be quietly dropping LINQ-SQL in favour of EF, which isn't exactly a ringing recommendation of LINQ-SQL :)
这取决于数据模型的架构。 我可以谈谈 SubSonic 的有效性,因为我正在启动它支持的网络应用程序。
我在使用 SubSonic 时遇到了 JOIN 和 DISTINCT 的问题。 这两次,我所要做的就是修补源代码并重建 DLL。 现在,我一点也不反对这样的事情,但你可能会。
除了这两个问题之外,SubSonic 使用起来很有趣。 选择非常简单且流畅。 它与 SQL 的映射相当接近,与 LINQ 的方式非常相似。 此外,SubSonic 还带有脚手架功能,应该能够为您预先构建某些页面。 我不确定它有多有效,因为我喜欢自己做这些事情。
另一件事是,选择特定行而不是 * 很慢,但仅限于调试模式。 一旦你编译发布,它实际上会更快。
这是我的两分钱。
That depends on the architecture of the data model. I can speak to the effectiveness of SubSonic, since I'm in the process of launching a web app that it backs.
I've run into problems with JOINs and DISTINCTs while using SubSonic. Both times, all I had to do is patch the source and rebuild the DLL. Now, I'm not at all averse to something like this, but you might be.
Other than those two problems, SubSonic is a joy to use. Selects are very easy and flowing. It maps fairly closely to SQL, much the same way LINQ does. Also, SubSonic comes with the scaffolding function that should be able to pre-build certain pages for you. I'm not sure how effective it is, since I like to do that stuff myself.
One more thing, selection of specific rows as opposed to * is slow, but only in debug mode. Once you compile for release, it's actually faster.
That's my two cents.
我开始使用 Linq to SQL,因为整个 linq 集成很棒,但是如果您想要模型优先而不是模式优先,并且想要拥有丰富的域模型,那么 nHibernate\Fluent nHibernate 确实是正确的选择。 我们改用了它,它比 l2s 简单得多,支持也更好。 但是,如果要将架构直接拖到 dbml 代码生成器中,linq to sql 就非常有用。
我也听说过关于 Mindscape Lightspeed 的好消息,但还没有使用过。
I started out using Linq to SQL as the whole linq integration is awesome, but if you want to do Model First rather than Schema First and you want to have a rich domain model then nHibernate\Fluent nHibernate is really the way to go. We switched to this and is far simpler, better supported than l2s. However for straight dragging your schema into the dbml code generator, linq to sql is great.
I have also heard very good things about Mindscape Lightspeed but have not used it.