tags:

views:

159

answers:

1

Is it possible using nHibernate, or Entity Framework, or whatever, to generate the SQL necessary to INSERT or UPDATE an object I've mapped to a table? I'm looking at generating SQL scripts from these POCO classes instead of running directly against a database.

The idea here is I'm taking some 2000+ line SQL scripts and I've made a Python-based DSL that does a lot of the work for us. I've got a C# application now that loads IronPython and 'compiles' the Python script, generating all of the necessary objects. I've got a prototype script here that's roughly 100 lines. Now, I need to actually generate the SQL script.

I could use something like nVelocity, but if this project is successful, I want to keep the long-term door open for running against a database. I've got roughly 30 tables with a few dozen columns per table to script out.

I found this but it appears to be generating the database table schema, rather than writing inserts and updates: https://forum.hibernate.org/viewtopic.php?f=25&t=1000334

The documentation on SchemaExport doesn't give a lot of information.

Suggestions / ideas?

A: 

I think it is not possible.It can generate the schema, but the sql for the crud is generated on the fly.

You can use tools that generates T-sql for doing the CRUD against a table.

Pablo Castilla
What tools are you referring to?
yodaj007
you have it here:http://stackoverflow.com/questions/2037802/crud-sp-generator-for-sql-server-2008-r2
Pablo Castilla