Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a .Net Micro ORM that will generate db schema?

Tags:

.net

orm

We'd like to get rid of NHibernate for something like Massive, PetaPoco, etc. but we really like the ability to generate our database automatically. With attributes it seems like PetaPoco has the information it needs to generate the db but I can't find anything that says it does.

Is there an alternative Micro ORM that does suport this?

like image 622
Shane Courtrille Avatar asked Nov 18 '11 19:11

Shane Courtrille


People also ask

What is PetaPoco?

PetaPoco is a thin Object Relational Mapper (ORM) for . NET applications.

What is OrmLite C#?

OrmLite is a set of light-weight C# extension methods around System. Data. * interfaces which is designed to persist POCO classes with a minimal amount of intrusion and configuration. Another Orm with similar goals is sqlite-net.

What is repo DB?

A database repository is a logical, but also sometimes physical grouping of data from related but separate databases. This is usually done when there is a 'higher purpose' for the data, but the data items needed to do this reside on different databases.

What is ORM in. net Core?

If you're writing a new ASP.NET Core application that needs to work with relational data, then Entity Framework Core (EF Core) is the recommended way for your application to access its data. EF Core is an object-relational mapper (O/RM) that enables . NET developers to persist objects to and from a data source.


2 Answers

ServiceStack's ORMLite is a Micro ORM that can create db schemas. It has CreateTable and DropTable methods.

like image 67
Ali Avatar answered Oct 16 '22 05:10

Ali


I looked into this extensively almost 2 years ago.

At that time, the only package that could automatically create a db schema from a real world (as opposed to toy) object model was the "big ORM" Fluent NHibernate Automapping , so that's what we ended up using.

It's generally worked well for us (though to be honest - session management is a pain, and we're currently having some problems upgrading to FNH 1.3/NH 3.2). But on balance, it's been a big win.

Subsonic looked very promising at the time - it was certainly much easier to use than FNH/NH. However, it only did very simple schemas like ActiveRecord automatically. Last I heard, it was no longer under active development, which is really too bad.

There may be other micro ORM options available now that will generate the schema, but I'm not aware of them.

If you just need persistance (as opposed to a relational database), you might want to look at some of the NoSQL options. I find RavenDB very interesting - seems to be as easy to use as Subsonic, but much more powerful. (licensing looks expensive, though).

like image 45
Tom Bushell Avatar answered Oct 16 '22 05:10

Tom Bushell