本文介绍了编写SQLite数据库脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在生成Schema.sql文件,我想以编程方式创建sqllite db文件并从该文件中执行所有sql语句.
I'm generating Schema.sql file and I want programatically to create sqllite db file and execute all sql statements from file.
谢谢
推荐答案您可以使用SchemaExport类生成脚本,和/或将其应用于数据库: nhibernate.info/doc/tutorials/first-nh-app/your-first- nhibernate-based-application.html
You can use the SchemaExport class to generate the scripts, and/or apply them to the database : nhibernate.info/doc/tutorials/first-nh-app/your-first-nhibernate-based-application.html
public class GenerateSchema_Fixture { [Test] public void Can_generate_schema() { var cfg = new Configuration(); cfg.Configure(); cfg.AddAssembly(typeof (Product).Assembly); new SchemaExport(cfg).Execute(true /*script*/, true /*export to db*/, false /*just drop*/, true /*format schema*/); } }更多推荐
编写SQLite数据库脚本
发布评论