0
votes

I'm generating Schema.sql file and I want programatically to create sqllite db file and execute all sql statements from file.

thanks

1
So far I was manually created db file with manually imported sql statements and now I want to move further and execute those programatically. So, I need some link examples, some site which point me to the right direction.user1765862
maybe this helps, Scripting SQLite database creation, swinbrain.ict.swin.edu.au/wiki/…BobRock

1 Answers

1
votes

You can use the SchemaExport class to generate the scripts, and/or apply them to the database : 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*/);
    }
}