I am current using SchemaUpdate because it creates new database if missing and upgrades it if I add new fields to the tables. However I would like to add a few Rows if the database is created, with a bit of data I can use in my applications.
Here is my current configuration for Fluent Nhibernate:
string connectionString = ConfigurationManager.ConnectionStrings["Sqlite"].ConnectionString;
_sessionFactory = Fluently.Configure()
.Database(SQLiteConfiguration.Standard
.ConnectionString(connectionString).ShowSql())
.Mappings(m => m.FluentMappings.AddFromAssemblyOf<MainWindow>())
.ExposeConfiguration(cfg => new SchemaUpdate(cfg).Execute(false, true))
.BuildSessionFactory();
I dont mind writing and transaction that needs to be done, in either SQL or from code, the think is I just dunno how to find out if database is newly created, and hence should run the transaction.
Aucun commentaire:
Enregistrer un commentaire