public static IUnitOfWorkFactory CreateUnitOfWorkFactory( IInterceptUnitOfWork interceptor = null, IAuditConfiguration auditConfiguration = null, IDateTime dateTime = null, IUserContext userContext = null) { var logger = new ConsoleLogger { DebugLoggingIsEnabled = false }; var databaseConfigurer = new SqlServerDatabaseConfigurer() .ConnectionStringName("Persistence"); var mapperConfigurer = new ByCodeMapperConfigurer() .RegisterEntitiesFromAssembly(Assembly.GetExecutingAssembly()); var configuration = new NHibernateConfiguration(logger); configuration.RegisterConfigurer(databaseConfigurer); configuration.RegisterConfigurer(mapperConfigurer); configuration.RegisterConfigurer(new ProxyConfigurer <CastleProxyFactoryFactory>()); IInterceptUnitOfWork[] interceptors = null; if (interceptor != null) { interceptors = new[] { interceptor }; } return(new NHibernateUnitOfWork.Factory(configuration, interceptors, auditConfiguration, dateTime, userContext, logger)); }
private void CompareSchema(string subSetConnectionString, params INHibernateConfigurer[] configurers) { var superSetConnectionString = ConfigurationManager.ConnectionStrings["Persistence"].ConnectionString; SqlServerSchema.Prepare(subSetConnectionString); var configuration = new NHibernateConfiguration(new ConsoleLogger { DebugLoggingIsEnabled = false }); foreach (var configurer in configurers) { configuration.RegisterConfigurer(configurer); } configuration.CreateSchema(); SqlServerSchema.AssertContained(new ConsoleLogger(), superSetConnectionString, subSetConnectionString, false); }