Subsonic 3 VS Entity Framework

前端 未结 2 898
庸人自扰
庸人自扰 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 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)

提交回复
热议问题