从类生成数据库结构的ORM

时间:2022-10-29 13:51:58

I have looked at NHibernate and EntitySpaces and they both seem to work differently.

我看过NHibernate和EntitySpaces,它们似乎都有不同的工作方式。

In EntitySpaces, you define the database tables and table relationships and the classes are generated for you.

在EntitySpaces中,您可以定义数据库表和表关系,并为您生成类。

In NHibernate, you define the classes and the table relationships are generated for you. This is what I am looking for.

在NHibernate中,您可以定义类,并为您生成表关系。这就是我要找的。

Are there any other ASP.NET ORMs that generate tables from classes like NHibernate? Any recommendations?

还有其他ASP.NET ORM从NHibernate这样的类生成表吗?有什么建议?

7 个解决方案

#1


This is something that NHibernate does.

这是NHibernate所做的事情。

And on the subject (that Draemon) started. My personal view is that unless performance is your absolute 1st priority and all other things must suffer to make that happen (e.g. when writing software for a manufacturing fab), you will be better off working on the domain model first.

关于这个主题(那个Draemon)开始了。我个人的观点是,除非性能是您的首要任务,并且所有其他事情都必须受到影响(例如,在为制造工厂编写软件时),您最好先处理域模型。

My reasoning: you spend a lot more time coding against the domain than you do against the database itself -- especially when using an orm. So spend that time wisely.

我的理由是:你花费了很多时间来编写域名而不是数据库本身 - 特别是在使用orm时。所以明智地花时间。

#2


DataObjects.Net also uses "Code first" (Model first) approach. See http://wiki.dataobjects.net/index.php?title=Features

DataObjects.Net也使用“Code first”(模型优先)方法。请参阅http://wiki.dataobjects.net/index.php?title=Features

#3


Linq to SQL can create the database table structures and relationships from the classes, with the dataContext.CreateDatabase() method.

Linq to SQL可以使用dataContext.CreateDatabase()方法从类创建数据库表结构和关系。

#4


Mindscape LightSpeed offers this ability - part of complete scheme round-tripping.

Mindscape LightSpeed提供此功能 - 完整计划往返的一部分。

Hope this helps

希望这可以帮助

http://www.mindscape.co.nz/blog/index.php/2008/06/17/schema-round-tripping-in-the-lightspeed-designer/

#5


I prefer an approach that I have full control to generate what I need as well. In the case of ORMs I get classes that match my tables. I believe that using my own domain of objects that derives from my business and not the underlying data store is the right way to go. My class hierarchies that represent my business data should be 100% independent from the data store.

我更喜欢一种我完全可以控制的方法来生成我需要的东西。在ORM的情况下,我得到与我的表匹配的类。我相信使用我自己的对象域来源于我的业务,​​而不是基础数据存储是正确的方法。我的业务数据的类层次结构应该100%独立于数据存储。

#6


LightSpeed has a really good Visual Studio designer that supports both generating .NET entity classes from the database and updating the database from your .NET entities.

LightSpeed有一个非常好的Visual Studio设计器,它支持从数据库生成.NET实体类和从.NET实体更新数据库。

#7


I had fairly good success working with Genome ORM. It does many jobs for you. You can first design your domain model and then generate the DB scripts out of that. Beside this Genome generates DTOs for you. It is pretty good at that and saves a lot of time of developers.

我与Genome ORM合作取得了相当不错的成功。它为你做了很多工作。您可以先设计域模型,然后从中生成数据库脚本。除此之外,Genome还为您生成DTO。它相当不错,节省了很多开发人员的时间。

http://www.genom-e.com

#1


This is something that NHibernate does.

这是NHibernate所做的事情。

And on the subject (that Draemon) started. My personal view is that unless performance is your absolute 1st priority and all other things must suffer to make that happen (e.g. when writing software for a manufacturing fab), you will be better off working on the domain model first.

关于这个主题(那个Draemon)开始了。我个人的观点是,除非性能是您的首要任务,并且所有其他事情都必须受到影响(例如,在为制造工厂编写软件时),您最好先处理域模型。

My reasoning: you spend a lot more time coding against the domain than you do against the database itself -- especially when using an orm. So spend that time wisely.

我的理由是:你花费了很多时间来编写域名而不是数据库本身 - 特别是在使用orm时。所以明智地花时间。

#2


DataObjects.Net also uses "Code first" (Model first) approach. See http://wiki.dataobjects.net/index.php?title=Features

DataObjects.Net也使用“Code first”(模型优先)方法。请参阅http://wiki.dataobjects.net/index.php?title=Features

#3


Linq to SQL can create the database table structures and relationships from the classes, with the dataContext.CreateDatabase() method.

Linq to SQL可以使用dataContext.CreateDatabase()方法从类创建数据库表结构和关系。

#4


Mindscape LightSpeed offers this ability - part of complete scheme round-tripping.

Mindscape LightSpeed提供此功能 - 完整计划往返的一部分。

Hope this helps

希望这可以帮助

http://www.mindscape.co.nz/blog/index.php/2008/06/17/schema-round-tripping-in-the-lightspeed-designer/

#5


I prefer an approach that I have full control to generate what I need as well. In the case of ORMs I get classes that match my tables. I believe that using my own domain of objects that derives from my business and not the underlying data store is the right way to go. My class hierarchies that represent my business data should be 100% independent from the data store.

我更喜欢一种我完全可以控制的方法来生成我需要的东西。在ORM的情况下,我得到与我的表匹配的类。我相信使用我自己的对象域来源于我的业务,​​而不是基础数据存储是正确的方法。我的业务数据的类层次结构应该100%独立于数据存储。

#6


LightSpeed has a really good Visual Studio designer that supports both generating .NET entity classes from the database and updating the database from your .NET entities.

LightSpeed有一个非常好的Visual Studio设计器,它支持从数据库生成.NET实体类和从.NET实体更新数据库。

#7


I had fairly good success working with Genome ORM. It does many jobs for you. You can first design your domain model and then generate the DB scripts out of that. Beside this Genome generates DTOs for you. It is pretty good at that and saves a lot of time of developers.

我与Genome ORM合作取得了相当不错的成功。它为你做了很多工作。您可以先设计域模型,然后从中生成数据库脚本。除此之外,Genome还为您生成DTO。它相当不错,节省了很多开发人员的时间。

http://www.genom-e.com