.NET ORM solution with class auto-generation: Subsonic, Castle AR, …?

前端 未结 6 613
终归单人心
终归单人心 2021-01-05 07:50

I used to work with a custom data mapping library, and curently I\'m trying to switch to a more widespread ORM solution.

After some experimentation, I refined my req

6条回答
  •  余生分开走
    2021-01-05 08:02

    • able to generate usable classes from database schema (SQL Server support is enough),
    • support for ActiveRecord pattern,
    • programmaticaly configurable (via code or attributes, no HBM files), free.
    1. Linq-to-SQL autogenerates from the database schema. One big problem is the property names are lowercase so you need a tool like this one to rename them. It isn't restricted to SQL Server.

    2. It sort of supports the ActiveRecord pattern - it's very close.

    3. The classes are configurable via the dbml file which is simply an XML file. Visual Studio generates a designer.cs file that allows you to add to the entities it produces as they're produced as partial classes.

    A few others to have a look at besides NH and Subsonic:

    • Lightspeed - free for under 8 entities, the link shows some example code. You have to define the mappings from tables to classes via an interface though so it doesn't meet 1)
    • LLBlgen - it's not free

提交回复
热议问题