Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 890
Shane van Wyk Avatar asked May 18 '26 14:05

Shane van Wyk


1 Answers

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.

like image 148
mythz Avatar answered May 20 '26 04:05

mythz