Guest User

Untitled

a guest
Jul 19th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.26 KB | None | 0 0
  1. private void Initialize()
  2. {
  3. var dbFile = "test.sqlite";
  4. EnsureDbFileNotExists(dbFile);
  5.  
  6. if (_configuration == null)
  7. {
  8. //_configuration = new Configuration().Configure(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "hibernate.config.xml"));
  9. //_configuration.AddAssembly(assemblyContainingMapping);
  10.  
  11. _configuration = new Configuration()
  12. .SetProperty(Environment.Dialect, typeof(SQLiteDialect).AssemblyQualifiedName)
  13. .SetProperty(Environment.ConnectionDriver, typeof(SQLite20Driver).AssemblyQualifiedName)
  14. .SetProperty(Environment.ConnectionProvider, typeof(DriverConnectionProvider).AssemblyQualifiedName)
  15. .SetProperty(Environment.ConnectionStringName, string.Format("data source={0}", dbFile))
  16. .SetProperty(Environment.ShowSql, "true")
  17. .SetProperty(Environment.ProxyFactoryFactoryClass, typeof(ProxyFactoryFactory).AssemblyQualifiedName)
  18. .AddAssembly(assemblyContainingMapping);
  19.  
  20. _sessionFactory = _configuration.BuildSessionFactory();
  21. }
  22.  
  23. new SchemaExport(_configuration).Execute(true, true, false, GetSession().Connection, Console.Out);
  24. }
Add Comment
Please, Sign In to add comment