/// <summary> /// 특정 Database System 종류에 대한 테스트용 DB 생성 및 UnitOfWork의 환경설정 정보를 제공하는 /// UnitOfWorkTestContextDbStrategy의 인스턴스를 빌드한다. /// </summary> /// <param name="databaseEngine">Database system 종류</param> /// <param name="databaseName">테스트용 Database name</param> /// <param name="properties">NHibernate configuration properties</param> /// <returns></returns> public static UnitOfWorkTestContextDbStrategy For(DatabaseEngine databaseEngine, string databaseName, IDictionary<string, string> properties) { UnitOfWorkTestContextDbStrategy strategy; switch(databaseEngine) { case DatabaseEngine.SQLite: strategy = new SQLiteUnitOfWorkTestContextDbStrategy(); break; case DatabaseEngine.SQLiteForFile: strategy = new SQLiteForFileUnitOfWorkTestContextDbStrategy(databaseName); break; case DatabaseEngine.MsSqlCe: strategy = new MsSqlCeUnitOfWorkTestContextDbStrategy(databaseName); break; case DatabaseEngine.MsSqlCe40: strategy = new MsSqlCe40UnitOfWorkTestContextDbStrategy(databaseName); break; case DatabaseEngine.MsSql2005: strategy = new MsSql2005UnitOfWorkTestContextDbStrategy(databaseName); break; case DatabaseEngine.MsSql2005Express: strategy = new MsSql2005ExpressUnitOfWorkTestContextDbStrategy(databaseName); break; case DatabaseEngine.OdpNet: strategy = new OdpNetUnitOfWorkTestContextDbStrategy(databaseName); break; case DatabaseEngine.DevartOracle: strategy = new DevartOdpNetUnitOfWorkTestContextDbStrategy(databaseName); break; case DatabaseEngine.MySql: strategy = new MySqlUnitOfWorkTestContextDbStrategy(databaseName); break; case DatabaseEngine.PostgreSql: strategy = new PostgreSqlUnitOfWorkTestContextDbStrategy(databaseName); break; case DatabaseEngine.Firebird: strategy = new FireBirdUnitOfWorkTestContextDbStrategy(databaseName); break; case DatabaseEngine.Cubrid: strategy = new CubridUnitOfWorkTestContextDbStrategy(databaseName); break; default: throw new NotSupportedException("currently not support a specified database engine=" + databaseEngine); } if(properties != null) foreach(var property in properties) strategy.NHibernateProperties[property.Key] = property.Value; return strategy; }
/// <summary> /// 특정 Database System 종류에 대한 테스트용 DB 생성 및 UnitOfWork의 환경설정 정보를 제공하는 /// UnitOfWorkTestContextDbStrategy의 인스턴스를 빌드한다. /// </summary> /// <param name="databaseEngine">Database system 종류</param> /// <param name="databaseName">테스트용 Database name</param> /// <param name="properties">NHibernate configuration properties</param> /// <returns></returns> public static UnitOfWorkTestContextDbStrategy For(DatabaseEngine databaseEngine, string databaseName, IDictionary <string, string> properties) { UnitOfWorkTestContextDbStrategy strategy; switch (databaseEngine) { case DatabaseEngine.SQLite: strategy = new SQLiteUnitOfWorkTestContextDbStrategy(); break; case DatabaseEngine.SQLiteForFile: strategy = new SQLiteForFileUnitOfWorkTestContextDbStrategy(databaseName); break; case DatabaseEngine.MsSqlCe: strategy = new MsSqlCeUnitOfWorkTestContextDbStrategy(databaseName); break; case DatabaseEngine.MsSqlCe40: strategy = new MsSqlCe40UnitOfWorkTestContextDbStrategy(databaseName); break; case DatabaseEngine.MsSql2005: strategy = new MsSql2005UnitOfWorkTestContextDbStrategy(databaseName); break; case DatabaseEngine.MsSql2005Express: strategy = new MsSql2005ExpressUnitOfWorkTestContextDbStrategy(databaseName); break; case DatabaseEngine.OdpNet: strategy = new OdpNetUnitOfWorkTestContextDbStrategy(databaseName); break; case DatabaseEngine.DevartOracle: strategy = new DevartOdpNetUnitOfWorkTestContextDbStrategy(databaseName); break; case DatabaseEngine.MySql: strategy = new MySqlUnitOfWorkTestContextDbStrategy(databaseName); break; case DatabaseEngine.PostgreSql: strategy = new PostgreSqlUnitOfWorkTestContextDbStrategy(databaseName); break; case DatabaseEngine.Firebird: strategy = new FireBirdUnitOfWorkTestContextDbStrategy(databaseName); break; case DatabaseEngine.Cubrid: strategy = new CubridUnitOfWorkTestContextDbStrategy(databaseName); break; default: throw new NotSupportedException("currently not support a specified database engine=" + databaseEngine); } if (properties != null) { foreach (var property in properties) { strategy.NHibernateProperties[property.Key] = property.Value; } } return(strategy); }