Schema.sqlファイルを生成していますが、プログラムでsqllite dbファイルを作成し、ファイルからすべてのsqlステートメントを実行したいと考えています。
ありがとう
Schema.sqlファイルを生成していますが、プログラムでsqllite dbファイルを作成し、ファイルからすべてのsqlステートメントを実行したいと考えています。
ありがとう
SchemaExport クラスを使用してスクリプトを生成したり、データベースに適用したりできます: http://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*/);
}
}