3

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

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

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

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

5
  • Going from the object side and auto-generate the database side seems like a really bad idea to me. There's no way it's going to generate a "good" database design. Just my 2c Commented Dec 18, 2008 at 3:25
  • But the other way around, it wouldn't generate a good object model! Commented Dec 18, 2008 at 3:47
  • I understand your question, but choosing an ORM based on the ability to auto-generate the table relationships is probably a bad idea. I've always had to tweak what the designer/generator outputs. Commented Dec 18, 2008 at 4:17
  • 1
    It depends on what you consider the "primary" reification of the model. Either your database model is primary, and the object model is a derivative, or the other way around. Commented Dec 23, 2008 at 15:35
  • nhibernate does not generate the db model by itself, you still have to do the mapping from object property to db field, define it`s datatyp and so on. after you done this nhibernate gives you the option to automatically create the db model in the specified dbms. how good or bad the db model will be still depends on you :) Commented Jul 15, 2009 at 11:31

7 Answers 7

4

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

Sign up to request clarification or add additional context in comments.

Comments

3

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

Comments

2

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

Hope this helps

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

1 Comment

Yes, but Lightspeed doesn't offer a very open choice of design... Composite keys are hardly/poorly supported, and per Mindscapes own web-site "We don't expect primary keys to have any business value". Mmmm. Great. Until it isn't.
1

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.

Comments

1

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.

Comments

0

This is something that NHibernate does.

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.

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.

Comments

0

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.

http://www.genom-e.com

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.