Question

I have just started using PetaPoco/NPoco in one of my projects and have to say that it rocks however, It seems that the library is not able to generate DDL and create a table based on the Poco. I know that OrmLite can do this.

Is there a way/workaround that can be used to for example decorate the poco and then based on the attributes DBMS specific table scripts are generated? e.g. Oracle, MSSql etc.

Thank you

Was it helpful?

Solution

No. PetaPoco seems (rightly) intent on staying small and lightweight, focusing on one thing (mapping between objects and IDb* concepts) and doing that well.

I could see this feature being semi-useful when running unit tests or very useful for prototyping, but IMO you want a DB migration manager to handle updates to your DB schema over time. Fluent Migrator is a good choice.

For me, it's about a separation of where we are (current PetaPoco / NPoco classes) and how we got here (migrations).

OTHER TIPS

Not sure exactly what you are after, but we use NPoco.T4 to generate our models from DB. Maybe look into it. You can find it on Nuget.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top