开发者

Export all sql generated by NHibernate to a text file

开发者 https://www.devze.com 2023-01-15 05:40 出处:网络
I have a console app that exports my entity models to my sql db and I am able to export that schema to an .sql file without issue. However, my DBA\'s want .sql files for all the initial data that shou

I have a console app that exports my entity models to my sql db and I am able to export that schema to an .sql file without issue. However, my DBA's want .sql files for all the initial data that should be populated in the db as well. My console app uses NHibernate to save a bunch of objects to the database right after it creates the database (Fluent NHibernate's .CreateDatabase()). But, now, I need to find a way开发者_如何学编程 to export all the inserts/updates that happen after creation. Looking around on google for a few minutes didn't turn up much. Any help would be appreciated.


You can enable tracing using

<property name="show_sql">true</property>

Then you can use .NET configuration to save your tracing to a file or just see it in DebugView and save it to a file in there.

Have a look in here:

http://support.microsoft.com/kb/815788


I don't know if I would deal with it like this. you can try a tool like red-gates SQL Packager it will generate both schema and the data scripts from your database.

0

精彩评论

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

关注公众号