public static void InitializeSessionFactory(string connectionString = "Data Source=local;Initial Catalog=mydb;Integrated Security=true;") { _sessionFactory = Fluently.Configure() .Database(MsSqlConfiguration.MsSql2008 .ConnectionString(connectionString).ShowSql() ) .Mappings(m => m.FluentMappings .AddFromAssemblyOf<Category>()) .ExposeConfiguration(cfg => new SchemaExport(cfg) .Create(false, false)) .BuildSessionFactory(); }
public static ISessionFactory SessionFactory { get { if (_sessionFactory == null) InitializeSessionFactory(); return _sessionFactory; } }
public static ISession OpenSession() { return SessionFactory.OpenSession(); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)