Search code examples
c#asp.netpostgresqlservicestackormlite-servicestack

Generating Class Object from Postgresql Database ServiceStack.Ormlite


We are in the process of developing a brand new application.

We want to use ASP.NET MVC 5 with ServiceStack.Ormlite.

Also want to use Postgresql database to store relational objects / tables.

Question: Is there a way / tool to generate C# Class Objects from the Postgresql Database which the ORM then can use to perform operations on the tables.

E.G. I have a table called "Person" in the Database.

What I want to do is, using some tool (Need to know which tool) to generate the C# class object so I can use servicestack.ormlite to add a new person to the table.

Then if I add a column to that table, I generate a new class to replace the old one.

Is that possible and which tool will allow me to do that?


Solution

  • OrmLite's primarily a code-first ORM but does have T4 Templates to help with initially generating the code-first POCO's for existing database tables.

    Although after generating the POCO's, I'd be maintaining them (i.e. code-first) from that point forward.