开发者

Generate SQL for POCO objects?

开发者 https://www.devze.com 2022-12-19 14:54 出处:网络
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

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 ope开发者_StackOverflow中文版n 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?


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消