mgamer
mgamer

Reputation: 14050

Create db schema from domain objects in .NET

In EJB 3.0 you can write your domain objecs, then convert them into entitities (adding @Entity attribute, etc.) and underlying JPA mechanism (let's say Hibernate) can automaticly generate db schema. What's better it will also update db when you update you domain model in Java code.

I'm looking for equivalent of that functionality on .NET platform. Is is possible with ADO.NET Entity Framework?

Upvotes: 2

Views: 737

Answers (6)

Alex Kofman
Alex Kofman

Reputation: 2173

DataObjects.Net also automatically generates and upgrades database schema according to domain model. But the most interesting thing is how to upgrade stored data if model and database schema are changed. Is it possible to do it on entity level, rather then using low-level SQL?

Upvotes: 3

Richard Hooper
Richard Hooper

Reputation: 819

Active Record is the way forward! You mark up your objects with attributes and from there you can generate the database schema or the database itself. There is also a tool called Active Writer which allows you to draw the models and it writes the codes with the correct attributes for you.

It is essentially a wrapper for NHibernate but it makes things a bit easier as you do the mapping on the objects rather than in XML documents.

We have used this on several projects and found it to be a fast way of implementing complex systems.

Upvotes: 2

Robert Lewis
Robert Lewis

Reputation: 527

NHibernate is a .NET port of Hibernate, and I think it includes tools for generating database schema for your entities.

Upvotes: 1

traskjd
traskjd

Reputation: 1008

Mindscape LightSpeed supports this - full schema round tripping with model first or database first development. It is a commercial product but there is a free version for small databases.

As mentioned, Entity Framework will add some of these features in their next release but that is some time away.

Details of the LightSpeed designer with the model first support

Upvotes: 2

Cheeso
Cheeso

Reputation: 192467

There are third party frameworks that do this in .NET today.

Upvotes: 0

marc_s
marc_s

Reputation: 754428

Yes - in the future :-) The current Entity Framework doesn't support the "domain-first" approach - but the next version (EF v4) will. This will ship with .NET 4.0 / Visual Studio 2010 - but don't ask me, when! I don't know (neither does Microsoft).

Marc

Upvotes: 1

Related Questions