tags:

views:

155

answers:

4

Is there any C# .NET ORM that can create databases ?
It should be capable of creating MS + MySQL + PostGre + Oracle databases at least.
And I don't mean tables or schemas, I mean the database only.
I use nHibernate, but it can only create tables and schemas, and query/insert but not creating the database itself.

+4  A: 

That's usually a little bit outside the scope of an ORM. There's a significant amount of complexity associated with creating a database that often has little to do with your application-specific mappings (permissions, access control, etc.). Sometimes ORM tools will generate the DDL/statements you need to create the database from scratch, but that's not quite the same thing as actually making the database itself.

John Feminella
Unfortunately, you seem to be the only person to grasp the question, and I'm getting despaired since it seems there really is no such tool, not even at a price.
Quandary
A: 

http://www.signumframework.com/

One of very few ORM based on Model-first approach.

alt text

Also note that future releases of Entity framework are supposed to support model-first approach.

this. __curious_geek
Quandary
Hey I'm not the creator or promoter of signum. I don't mind you giving me a negative vote on my answer but this should not affect the reputation of signum or its creators. If I'd be the signum guy why would I include Entity Framework in my answer.
this. __curious_geek
Well, not sure. I'm not the one who gave you a negative vote though, since it's remotely related to my question.
Quandary
A: 

I've used nHibernate's (NHibernate.Tool.hbm2ddl) SchemaExport feature to generate DDL from my classes and mapping.

Check these out:

Create DB from Classes and Mappings with NHibernate-Domain Driven Design
NH Toolset Guide

A related SO Post:
NHibernate SchemaExport and Configure() catch-22

Update:
After reading your comment, I'm not quite sure this is what you need. Anyway, just for info.

o.k.w
I suspect schema export can do what he wants. See http://wiki.fluentnhibernate.org/Schema_generation
Hamish Smith
Yes, creation works there, but only for SQlite.When I replaced with MS-SQL, it didn't work.
Quandary
Yes this is not what I need. Besides, I highly doubt that with system.data.sqlclient.sqlconnection you can connect to anything else but a MS-SQL server...
Quandary
I got mine working with mySql though. The db connector can be configured for various db engines/servers though i have not tried it with ms sql.
o.k.w
What you are proposing is writing a connector for every database.That's beside the point. Looks like my application won't be zero conf after all...
Quandary
Not writing, but configuring. Yes, your app probably won't be zero-config.
o.k.w
+2  A: 

DataObjects.Net - it is designed for model-first approach; it supports MS SQL, Oracle and PostgreSQL. MySQL support is planned.

See Database Schema Upgrade chapter of the Manual - it explains the details related to runtime schema creation and upgrade.

In contrast to Signum framework (that actually very close by the approach it supports), DataObjects.Net has almost no limitations related to mapping. E.g. you can use composite primary\foreign keys. Its another advantage is perfect LINQ support.

P.S. I'm one of its authors.

Alex Yakunin
I just noticed you want the database itself to be created as well. DataObjects.Net currently isn't capable of this, but I immediately found this feature request in our issue tracker: http://code.google.com/p/dataobjectsdotnet/issues/detail?id=509 - so quite likely, this will be done some day.
Alex Yakunin
Alex Yakunin
So actually, if you're choosing ORM, I recommend you to pay more attention on other features. This problem (database creation) actually requires just about a day to be solved by your own. But other ORM features will be used for many weeks...
Alex Yakunin
Well, then it seems like nhibernate just got one more developer ;-))
Quandary
As you might assume, I'm not its fan - but good luck with it ;)
Alex Yakunin