Subsonic 3 VS Entity Framework

前端 未结 2 902
庸人自扰
庸人自扰 2021-02-06 09:36

Anyone worked with Subsonic3 and Entity Framework here who can tell me the pros and cons? This is my first time attempting to try these. Subsonic is easy to setup so as the Enti

相关标签:
2条回答
  • 2021-02-06 09:57

    In case this helps, in my benchmarks I used Subsonic 2.1 (as stated) and compared data access layers in a moderate load scenario (methodology as stated). I provided code, so my test can easily be replicated.

    If you subject the system to load, reproducing the conditions in a web application while in use, EF proves to offer much better performance. Load tests of the complete web application confirm this. In more complex tests, the optimisation capabilities of EF such as lazy-loading can offer yet greater performance advantages over Subsonic.

    If you compare individual data access operations, e.g. in a simple unit test, Subsonic appears to be faster. In particular, Subsonic initialised more quickly.

    I would recommend Fluent NHibernate or Entity Framework if performance is a key consideration.

    0 讨论(0)
  • 2021-02-06 10:08

    Well, these two are quite different beasts!

    Subsonic 3 is a great tool for simply and easily mapping a database structure pretty much 1:1 to object classes, where each class will be an exact representation of the table in the underlying database (as is the case with Linq-to-SQL as well).

    Entity Framework on the other hand targets much more complex scenarios, where your domain or object model (your classes) will not necessarily map 1:1 to database tables. That's why the EF has a trilogy of XML files - one describing the conceptual level (your domain objects), one the storage level (the database layout), and the mapping in between those two.

    IMHO, Subsonic 3 and Linq-to-SQL are perfect for quick, small to medium size projects, where your database is flexible enough to change if need be, and where you have a pretty straightforward mapping of your objects to tables. EF really shines in large-scale enterprise apps, where your database level might be set in stone, and you can't change it - or your app needs to "survive" even if the underyling database changes.

    Totally different beasts - totally different audiences, in my opinion.

    Marc

    PS: I wonder if Tim was really using Subsonic 3 in this comparison, and what exactly he was doing. My gut feeling would have been that EF would be the "bigger" overhead and thus might be a bit less performant (but more flexible, and in Enterprise scenarios, that's worth its weight in gold, even when sacrificing some performance for it)

    0 讨论(0)
提交回复
热议问题