开发者

Generate SQL for POCO objects?

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜