亚音速ORM体验 [英] Subsonic ORM experience

查看:218
本文介绍了亚音速ORM体验的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在寻找新的ORM的一个重要的项目,即时通讯使用NHibernate的用ActiveRecord,我已经有一个非常坏的experiencia与EF4,性能和崩溃的GUI。

所以,搜索网页,我发现了亚音速,我喜欢我所读到的文件中。

所以,我想知道是否有人已经使用了亚音速,如果经验是不错的。

解决方案

嗯......嗯......我应该怎么把它....

我目前(如现在),花费精力来代替亚音速与 PetaPoco 。我想,说什么的。

这并不是说亚音速是坏了,但是那不适合我的发展很好的方式。而对于人们希望采用它在这一点上,似乎非常重要的是要注意,绝对缺乏活动的项目。

首先,亚音速不适合我的最大原因是LINQ。

有魅力具有的所有财产使用编译器检查,以确保万无一失。然而,在实践中,它根本不是非常适合于查询。

如果你坚持非常接近的类每个表和放大器; ActiveRecord的使用,我想这是确定的。但每当我们不得不作出超出(任何涉及多个表或超出了简单的where子句有的话)有任何疑问,这是一场噩梦。协会的不能直接用在亚音速LINQ查询,就像他们可以在EF或NHibernate的,这可能是最大的痛点。

例如,像这样将不可以工作亚音速在EF查询,但它会:

  db.Accounts.Where(A =>!a.OwningUser.Email = NULL);
 

当我最终要么使许多往返数据库组装的结果,或者使用亚音速的 CodingHorror 类直接与查询SQL,并且暂时无法简单地兑现他们作为一个POCO(同样,当超越简单的类,每个表)。

我还发现,每一个LINQ提供程序支持不同操作的集合,有时同样的逻辑运算将有稍微不同的语法和提供者之间使用。这使得编写大多数查询,非常耗时且容易出错。亚音速的LINQ提供程序是在功能的古怪和短缺。这并不难望其项背到LINQ-2-SQL,实体框架或LINQ NHibernate的这方面支持的操作,可用性,或执行速度(准备学习的LINQ只为亚音速写作加入新的方式 - <一个href="http://groups.google.com/group/subsonicproject/browse_thread/thread/8f7cb1f1d6a6d56c?hl=en">and准备有一些常用的操作根本是不可能的亚音速的LINQ提供程序,尽管是已知的错误了一年)。

在除了对生产力的阻力,很容易忘记,你正在写的LINQ code是非常提供具体的。 ANSI SQL是更多的标准,比LINQ跨平台兼容性。

LINQ还勾引我与重用code有类似规格的技术,但这些充实了很远很容易的可能性,而最终的结果是甚至还没有接近值得努力。我在这里遇到的障碍主要是由于这样的事实,亚音速的LINQ提供了对协会的支持。

亚音速设施LINQ之外,我觉得是平庸,充其量(在我看来)。

其次,重要的是要知道,所有的措施亚音速不是一个活跃的项目。

亚音速,罗布科纳,最初的创造者不再对项目工程。 最后一次提交抢发在2010年7月

最后一次提交的项目都为3个月前,的尽管近100名优秀问题。而据我所知没有发生过任何版本,甚至没有一个小点发布,因为罗布停止工作亚音速(虽然人们仍然挂在该项目已经<一个href="http://groups.google.com/group/subsonicproject/browse_thread/thread/d1b993b7208be2a6?hl=en">talking关于发布时间超过半年)。

的谷歌集团亚音速的习惯是积极的,但这些天没有这么多。并且还<打击> 为亚音速项目的官方网站已经黄筛查的死亡一段时间 (该网站不再黄色屏幕)。

在数据访问新的辣味是微ORM的。亚音速的创造者,实际上,那种与大规模踢这个趋势了,随后不久之后,由StackExchange船员释放<一href="http://samsaffron.com/archive/2011/03/30/How+I+learned+to+stop+worrying+and+write+my+own+ORM">Dapper,后来 PetaPoco 就出来了。有一对夫妇更也。尽管我们给了一个小的编译器通过在我们的code基本SQL代码段检查,我发现微ORM配合比亚音速做我的开发风格好多了。

我的经验(尽管有限)与NHibernate是,它是过于复杂的大多数情况下,甚至当它是适当的它绝对是谋杀了我的应用程序启动时间。也有很高的学习曲线(这可能是过去的),也有几种方法可以做到..基本上一切..所以它只是增加了更多的决定了我的过程中(减缓我失望)。

通过PetaPoco,我可以写熟悉的SQL - 我快和相当不错的与 - 和兑现成POCO的,我知道你到底做立即。架构和组织的小洒和自动化集成测试,我根本不觉得脏有关嵌入的SQL位。

呵呵,我想过去的事情 - 亚音速还远远没有得到数据的最快方法。或许并不重要,但它竟然是我们。

结论(抱歉文字的墙):

这并不是说亚音速是坏在绝对意义。它只是似乎并不适合我试图利用好所有的方式 - 和一个很大一部分是因为LINQ仍然是一个漏水的抽象,它是在漏水比我用不同的方式。

事实上,发展的努力几乎是不存在的是有好有坏。好,它是稳定的,并在一定意义上被认为是完成。坏,它缺乏的功能,可能有一些错误,而不是最好的表演者 - 而且也没有一个工作,提高了

I'm looking for new ORM for a important project, im used to nHibernate with ActiveRecord and I already have a very bad experiencia with EF4, performance and crashing GUI.

So search on web I found the Subsonic, i liked what I read in the documentation.

So, I would like to know if anyone already used the Subsonic and if the experience was good.

解决方案

Hmm ... well ... how should I put it....

I am currently (as in right now) expending effort to replace SubSonic with PetaPoco. I suppose that says something.

It's not that SubSonic was bad exactly, but it didn't fit my way of developing very well. And for people looking to adopt it at this point, it seems very important to note the absolute lack of activity on the project.

First, the biggest reason SubSonic didn't fit me was LINQ.

There is allure in having compiler checking of all property use, to be sure. However, in practice, it simply was not well suited to querying.

If you stick very closely to class-per-table & ActiveRecord use, I suppose it is ok. But whenever we had to make any query beyond that (anything involving multiple tables or anything beyond the simplest where clauses), it was a nightmare. Associations cannot be used directly in a SubSonic LINQ query, like they can in EF or nHibernate, which was probably the largest pain point.

For example, a query like this will not work in SubSonic, but it would in EF:

db.Accounts.Where(a => a.OwningUser.Email != null);

Where I ended up was either making many round trips to the database to assemble a result, or using SubSonic's CodingHorror class to query directly with SQL, and being unable to simply materialize them as a POCO (again, when going beyond simple class-per-table).

I also found that every LINQ provider supports different sets of operations, and sometimes the same logical operation will have slightly different syntax and use between providers. This made writing most queries very time consuming and error prone. SubSonic's LINQ provider is no shortage of quirky and under-featured. It doesn't come anywhere close to Linq-2-SQL, Entity Framework, or LINQ to nHibernate it terms of supported operations, usability, or speed of execution (be ready to learn new ways of writing joins in LINQ just for SubSonic - and be ready to have some common operations simply not be possible with SubSonic's LINQ provider, despite being known bugs for a year).

In addition to the drag on productivity, it is easy to forget that the LINQ code you are writing is very provider specific. ANSI SQL is far more standard and cross-compatible than LINQ.

LINQ also seduced me with the possibilities of reusing code with techniques like Specifications, but fleshing these out was far from easy, and the end result was not even close to worth the effort. The roadblocks I encountered here were largely due to the fact that SubSonic's LINQ provider had no support for associations.

SubSonic's facilities outside of LINQ I felt were mediocre at best (in my opinion).

Second, it is important to know that by all measures SubSonic is not an active project.

The initial creator of SubSonic, Rob Conery, no longer works on the project. The last commit Rob made was in July 2010.

The last commit to the project at all was 3 months ago, despite nearly 100 outstanding issues. And as far as I can tell there hasn't been any release, not even a minor point release, since Rob ceased working on SubSonic (though the folks still hanging around the project have been talking about a release for more than half a year).

The Google Group for SubSonic used to be active, but these days not so much. And also the official website for the SubSonic project has been yellow-screening-of-death for a while (The site no longer yellow screens).

The new hotness in data access is micro-ORM's. SubSonic's creator, actually, kind of kicked this trend off with Massive, followed soon after by the StackExchange crew releasing Dapper, and later PetaPoco came out. There's a couple more, too. And while we're giving up a little compiler checking by having SQL snippets in our code base, I find the micro-ORM fits my development style much better than SubSonic did.

My experience (albeit limited) with nHibernate was that it is overly complicated for most scenarios, and even when it is appropriate it absolutely murdered my application start up times. There was also a high learning curve (which you may be past), but also there is several ways to do .. basically everything .. so it just adds that many more decisions into my process (slowing me down).

With PetaPoco, I can write familiar SQL - I am quick and reasonably good with that - and materialize them into POCO's, which I know what the heck to do with immediately. A little sprinkling of architecture and organization and automated integration testing and I don't at all feel dirty about embedding bits of SQL.

Oh, and I suppose last thing - SubSonic is far from the fastest way to get data. May not be important, but it turned out to be for us.

In conclusion (sorry for the wall of text):

It's not that SubSonic is bad in any absolute sense. It just didn't seem to fit the ways I tried to use it well at all - and a large part of that is because LINQ is still a leaky abstraction, and it is leaky in different ways than I am used to.

The fact that development efforts are nearly non-existent is good and bad. Good, it is stable and considered "finished" in a sense. Bad, it lacks features, possibly has some bugs, and isn't the best performer - and there's no one working to improve that.

这篇关于亚音速ORM体验的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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