Usefull for test cases.
Inheritance: IConfigurationSource
		/// <summary>
		/// The common test setup code. To activate it in a specific test framework,
		/// it must be called from a framework-specific setup-Method.
		/// </summary>
		public virtual void SetUp()
		{
			ActiveRecordStarter.ResetInitializationFlag();
			Dictionary<string, string> properties = new Dictionary<string, string>();
			properties.Add("connection.driver_class", "NHibernate.Driver.SQLite20Driver");
			properties.Add("dialect", "NHibernate.Dialect.SQLiteDialect");
			properties.Add("connection.provider", typeof(InMemoryConnectionProvider).AssemblyQualifiedName);
			properties.Add("connection.connection_string", "Data Source=:memory:;Version=3;New=True");
			properties.Add("proxyfactory.factory_class", "NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle");
			foreach (var p in GetProperties())
			{
				properties[p.Key] = p.Value; 
			}

			var config = new InPlaceConfigurationSource();
			config.Add(typeof(ActiveRecordBase), properties);
			foreach (var type in GetAdditionalBaseClasses())
			{
				config.Add(type, properties);
			}
			Configure(config);
			
			var types = GetTypes();
			var assemblies = GetAssemblies();

			if (types == null) types = new Type[0];
			if (assemblies == null) assemblies = new Assembly[0];

			ActiveRecordStarter.Initialize(assemblies,config,types);
			ActiveRecordStarter.CreateSchema();
		}
        public static void StartDatabase()
        {
            if (Utilities.ConfigurationManager.GetStringValue("SQLUsername") == "root")
            {
                Utilities.ConsoleStyle.Warning(@"'root' Username is not safe, please modify this for your security");
            }
            var config = new DatabaseConfiguration(DatabaseType.MySQL, Utilities.ConfigurationManager.GetStringValue("SQLHost"),
                                                    Utilities.ConfigurationManager.GetStringValue("SQLDB"),
                                                    Utilities.ConfigurationManager.GetStringValue("SQLUsername"), Utilities.ConfigurationManager.GetStringValue("SQLPassword"));

            var source = new InPlaceConfigurationSource();
            source.Add(typeof(ActiveRecordBase), config.GetProperties());

            ActiveRecordStarter.Initialize(source,
                            typeof(CharacterRecord), typeof(MapRecords),
                            typeof(TriggerRecord), typeof(ItemRecord), typeof(WorldItemRecord),
                            typeof(NpcRecord), typeof(NpcPositionRecord), typeof(NpcDialogRecord),
                            typeof(ZaapRecord), typeof(AccountDataRecord), typeof(OriginalBreedStartMapRecord),
                            typeof(IncarnamTeleportRecord), typeof(ExpFloorRecord), typeof(BaseSpellRecord),
                            typeof(MonstersTemplateRecord), typeof(MonsterLevelRecord), typeof(MountTemplateRecord),
                            typeof(GuildCreatorLocationRecord), typeof(SpellRecord), typeof(ShopItemRecord),
                            typeof(BreedRecord), typeof(GuildRecord), typeof(DungeonRoomRecord),
                            typeof(WorldMountRecord), typeof(PaddockRecord), typeof(DropRecord),
                            typeof(BannedAccountRecord), typeof(ElitesRecord), typeof(LiveActionRecord),
                            typeof(HotelRecord), typeof(ServerInfoRecord), typeof(ItemSetRecord),
                            typeof(IODataRecord), typeof(JobDataRecord), typeof(CraftRecord), typeof(ItemBagRecord),
                            typeof(AuctionHouseRecord), typeof(AuctionHouseItemRecord));
        }
 public static void StartDatabase()
 {
     var config = new DatabaseConfiguration(DatabaseType.MySQL, Utilities.ConfigurationManager.GetStringValue("SQLHost"),
                                             Utilities.ConfigurationManager.GetStringValue("SQLDB"),
                                             Utilities.ConfigurationManager.GetStringValue("SQLUsername"), Utilities.ConfigurationManager.GetStringValue("SQLPassword"));
     var source = new InPlaceConfigurationSource();
     source.Add(typeof(ActiveRecordBase), config.GetProperties());
     ActiveRecordStarter.Initialize(source, typeof(AccountRecord), typeof(GameServerRecord),
         typeof(AccountCharactersInformationsRecord));
 }
        public static bool Initialize(FileInfo databaseFile)
        {
            try
            {
                bool existsSchema = true;

                IDictionary<string, string> properties = new Dictionary<string, string>();

                properties.Add("connection.driver_class", "NHibernate.Driver.SQLite20Driver");
                properties.Add("dialect", "NHibernate.Dialect.SQLiteDialect");
                properties.Add("query.substitutions", "true=1;false=0");
                properties.Add("proxyfactory.factory_class", "NHibernate.ByteCode.LinFu.ProxyFactoryFactory, NHibernate.ByteCode.LinFu");
                properties.Add("show_sql", "true");
                properties.Add("format_sql", "true");
                properties.Add("isDebug", "true");
                properties.Add("connection.connection_string", String.Format("Data Source={0};New=False;", databaseFile.FullName));

                InPlaceConfigurationSource source = new InPlaceConfigurationSource();
                source.Add(typeof(ActiveRecordBase), properties);

                List<Assembly> assembliesEntityc = new List<Assembly>();
                assembliesEntityc.Add(Assembly.Load("KPCodeGen.Entity"));
                if (!ActiveRecordConfiguration.IsInitialized)
                {
                    try
                    {
                        // Criação do Banco de dados SQLLite
                        if (!SQLLiteHelper.SQLLiteDatabaseFile.Exists)
                            existsSchema = false;

                        SQLLiteHelper.CreateDatabaseFile(databaseFile);
                    }
                    catch (Exception)
                    {
                        throw;
                    }

                    ActiveRecordStarter.Initialize(assembliesEntityc.ToArray(), source);
                }

                if (!existsSchema)
                    ActiveRecordStarter.CreateSchema();
                else
                    ActiveRecordStarter.UpdateSchema();


                return ActiveRecordStarter.IsInitialized;
            }
            catch (Exception)
            {
                throw;
            }
        }
	    private InPlaceConfigurationSource _GetConfigSource()
	    {	        
			Dictionary<string, string> properties = new Dictionary<string, string>();
			properties.Add("connection.driver_class", "NHibernate.Driver.NpgsqlDriver");
	        properties.Add("dialect", "NHibernate.Dialect.PostgreSQLDialect");
	        properties.Add("connection.provider", "NHibernate.Connection.DriverConnectionProvider");
			properties.Add("proxyfactory.factory_class", "NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle");
			properties.Add("show_sql", _ShowSql.ToString());
	        properties.Add("connection.connection_string", _ConnectionString);
			InPlaceConfigurationSource source = new InPlaceConfigurationSource();
			source.Add(typeof(ActiveRecordBase), properties);	        
			return source;
	    }
Exemple #6
0
        public static void SetUpActiveRecord()
        {
            var properties = new Dictionary<string, string> {
            {"connection.driver_class", "NHibernate.Driver.SqlClientDriver"},
            {"dialect", "NHibernate.Dialect.MsSql2005Dialect"}, {"connection.provider", "NHibernate.Connection.DriverConnectionProvider"},
            {"connection.connection_string", ConfigurationManager.ConnectionStrings["KanbanFile"].ConnectionString},
            {"proxyfactory.factory_class", "NHibernate.ByteCode.Castle.ProxyFactoryFactory,NHibernate.ByteCode.Castle"}
            };

            var source = new InPlaceConfigurationSource {IsRunningInWebApp = true};

            source.Add(typeof(ActiveRecordBase), properties);

            ActiveRecordStarter.Initialize(Assembly.GetExecutingAssembly(), source);
        }
        /// <summary>
        /// Builds an <see cref="InPlaceConfigurationSource"/> for the specified database.
        /// </summary>
        /// <param name="database">The database type.</param>
        /// <param name="connectionString">The connection string.</param>
        /// <returns></returns>
        public static InPlaceConfigurationSource Build(DatabaseType database, string connectionString)
        {
            if (string.IsNullOrEmpty(connectionString))
            {
                throw new ArgumentNullException("connectionString");
            }

            var config = new InPlaceConfigurationSource();

            var parameters = new DefaultDatabaseConfiguration().For(database);

            parameters["connection.connection_string"] = connectionString;
            config.Add(typeof(ActiveRecordBase), parameters);

            return(config);
        }
		protected IConfigurationSource GetConfigSource()
		{
			InPlaceConfigurationSource source = new InPlaceConfigurationSource();

			Dictionary<string,string> properties = new Dictionary<string,string>();
			properties.Add("hibernate.connection.driver_class", "NHibernate.Driver.SqlClientDriver");
			properties.Add("hibernate.dialect", "NHibernate.Dialect.MsSql2000Dialect");
			properties.Add("hibernate.connection.provider", "NHibernate.Connection.DriverConnectionProvider");
			properties.Add("hibernate.connection.connection_string",
			               "Data Source=.;Initial Catalog=test;Integrated Security=SSPI");

			source.Add(typeof(ActiveRecordBase), properties);
			source.Add(typeof(NonAbstractRootType), properties);

			return source;
		}
        private static void Initialize()
        {
            IDictionary<string, string> properties = new Dictionary<string, string>();
            properties.Add("connection.driver_class", "NHibernate.Driver.SQLite20Driver");
            properties.Add("dialect", "NHibernate.Dialect.SQLiteDialect");
            properties.Add("connection.provider",
                           "ImagineClub.Tests.SqLiteInMemoryTestingConnectionProvider, ImagineClub.Tests");
            properties.Add("connection.connection_string", "Data Source=:memory:;Version=3;New=True;");
            properties.Add("show_sql", "true");
            properties.Add("proxyfactory.factory_class",
                           "NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle");

            var source = new InPlaceConfigurationSource();
            source.Add(typeof (ActiveRecordBase), properties);

            ActiveRecordStarter.Initialize(source, typeof (Member).Assembly.GetTypes());
            ActiveRecordStarter.CreateSchema();
        }
Exemple #10
0
        private void SetupAR()
        {
            //BasicConfigurator.Configure();
            XmlConfigurator.Configure(new FileInfo(Server.MapPath("/log4net.config")));
            var arConfig = new InPlaceConfigurationSource();
            var properties = new Dictionary<string, string> {
                {Environment.ConnectionDriver, typeof(SQLite20Driver).FullName},
                {Environment.ProxyFactoryFactoryClass, typeof(ProxyFactoryFactory).AssemblyQualifiedName},
                {Environment.Dialect, typeof(SQLiteDialect).FullName},
                {Environment.ConnectionProvider, typeof(DriverConnectionProvider).FullName},
                {Environment.ConnectionString, "Data Source=test.db;Version=3;New=True;"},
            };

            arConfig.Add(typeof (ActiveRecordBase), properties);
            ActiveRecordStarter.ResetInitializationFlag();
            ActiveRecordStarter.Initialize(arConfig, typeof (Person));
            ActiveRecordStarter.CreateSchema();
        }
        protected void Application_Start()
        {
            IDictionary<string, string> properties = new Dictionary<string, string>();

            properties.Add("connection.driver_class", "NHibernate.Driver.SQLite20Driver, NHibernate");
            properties.Add("dialect", "NHibernate.Dialect.SQLiteDialect");
            properties.Add("connection.provider", "NHibernate.Connection.DriverConnectionProvider");
            properties.Add("connection.connection_string", "Data Source=c:\\sqlite\\employees.db");
            properties.Add("proxyfactory.factory_class", "NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle");

            InPlaceConfigurationSource source = new InPlaceConfigurationSource();

            source.Add(typeof(ActiveRecordBase), properties);

            ActiveRecordStarter.Initialize(source, typeof(JobTitle), typeof(Employee));

            AreaRegistration.RegisterAllAreas();

            RegisterRoutes(RouteTable.Routes);
        }
Exemple #12
0
        public static IConfigurationSource InitFirebird()
        {
            const string dbFile = "test.fdb";
            const string connectionString = "Database=" + dbFile + ";ServerType=1";
            if (File.Exists(dbFile))
                File.Delete(dbFile);
            FbConnection.CreateDatabase(connectionString);
            var arConfig = new InPlaceConfigurationSource();
            var properties = new Dictionary<string, string> {
                {Environment.ConnectionDriver, typeof (FirebirdClientDriver).FullName},
                {Environment.Dialect, typeof (FirebirdDialect).FullName},
                {Environment.ConnectionProvider, typeof (DriverConnectionProvider).FullName},
                {Environment.ConnectionString, connectionString},
                {Environment.ProxyFactoryFactoryClass, typeof (ProxyFactoryFactory).AssemblyQualifiedName},
            };

            arConfig.Add(typeof (ActiveRecordBase), properties);
            ActiveRecordStarter.ResetInitializationFlag();
            return arConfig;
        }
Exemple #13
0
        public static InPlaceConfigurationSource GetConfigurationSource(bool isWeb)
        {
            // Load the Connection String
            var currentConnectionString = ConfigurationManager.ConnectionStrings["connection_string"].ConnectionString;

            // Create a new set of Configuration, and add the connection string
            var properties = new Dictionary<string, string> { { "connection.connection_string", currentConnectionString } };
            var source = new InPlaceConfigurationSource();
            source.Add(typeof(ActiveRecordBase), properties);

            // Get the configuration from the ActiveRecord section
            var activeRecordSectionSource = ActiveRecordSectionHandler.Instance;
            var activeRecordConfiguration = activeRecordSectionSource.GetConfiguration(typeof(ActiveRecordBase)).Children;
            var connectionStringConfiguration = source.GetConfiguration(typeof(ActiveRecordBase)).Children;

            // Add configuration from the ActiveRecord section
            connectionStringConfiguration.AddRange(activeRecordConfiguration);

            source.IsRunningInWebApp = isWeb;
            return source;
        }
        public static void Setup(TestContext testContext) 
        {
            if (!ActiveRecordStarter.IsInitialized)
            {
                //Castle.ActiveRecord.Framework.IConfigurationSource config = ActiveRecordSectionHandler.Instance;
                //Castle.ActiveRecord.Framework.IConfigurationSource config = new XmlConfigurationSource("QuartzAdmin.web.Tests.dll.config");
                InPlaceConfigurationSource config = new InPlaceConfigurationSource();
                Dictionary<string, string> properties = new Dictionary<string, string>();

                properties.Add("connection.driver_class", "NHibernate.Driver.SQLite20Driver");
                properties.Add("dialect", "NHibernate.Dialect.SQLiteDialect");
                properties.Add("connection.provider", "NHibernate.Connection.DriverConnectionProvider");
                properties.Add("connection.connection_string", "Data Source=|DataDirectory|..\\..\\..\\database\\quartz_admin.db");
                properties.Add("proxyfactory.factory_class", "NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle");

                config.Add(typeof(ActiveRecordBase), properties);

                Assembly asm1 = Assembly.Load("QuartzAdmin.web");
                ActiveRecordStarter.Initialize(asm1, config);
            }

        }
Exemple #15
0
        public void FixtureSetup()
        {
            BasicConfigurator.Configure();
            var arConfig = new InPlaceConfigurationSource();
            var properties = new Dictionary<string, string> {
                {Environment.ConnectionDriver, typeof(SQLite20Driver).FullName},
                {Environment.Dialect, typeof(SQLiteDialect).FullName},
                {Environment.ConnectionProvider, typeof(DriverConnectionProvider).FullName},
                {Environment.ConnectionString, "Data Source=test.db;Version=3;New=True;"},
                {Environment.ProxyFactoryFactoryClass, typeof(ProxyFactoryFactory).AssemblyQualifiedName},
            };

            arConfig.Add(typeof (ActiveRecordBase), properties);
            ActiveRecordStarter.ResetInitializationFlag();
            ActiveRecordStarter.Initialize(arConfig, typeof (Form), typeof (FormPartA), typeof (FormPartB));
            ActiveRecordStarter.CreateSchema();
        }
Exemple #16
0
        private void InitActiveRecord()
        {
            INSNConfig config = this.container.Resolve<INSNConfig>();
            ConnectionStringSettingsCollection cfgSettings = WebConfigurationManager.ConnectionStrings;
            NameValueCollection db = WebConfigurationManager.GetSection("databaseSettings", "~/" + Globals.CONFIG_FOLDER_PATH) as NameValueCollection;
            NameValueCollection ar = WebConfigurationManager.GetSection("activeRecordSettings", "~/" + Globals.CONFIG_FOLDER_PATH) as NameValueCollection;

            IDictionary<string, string> settings = new Dictionary<string, string>();
            foreach (string key in ar.AllKeys)
            {
                settings[key] = ar[key];
            }

            string connStrKey = "connection.connection_string";
            string connStrNameKey = "connection.connection_string_name";
            bool hasConnectionStringName = settings.ContainsKey(connStrNameKey) && settings[connStrNameKey].Length > 0;
            bool hasConnectionString = settings.ContainsKey(connStrKey) && settings[connStrKey].Length > 0;

            if (!hasConnectionStringName && !hasConnectionString ||
                hasConnectionStringName && settings[connStrNameKey].Equals("tien.somee.com"))
            {
                bool isRemote = Convert.ToBoolean(config[Globals.ISREMOTE]);
                string @connectionString = (isRemote
                            ? cfgSettings[Globals.CONNECTION_REMOTE_NAME]
                            : cfgSettings[Globals.CONNECTION_LOCAL_NAME]
                        ).ConnectionString;
                connectionString = isRemote
                        ? string.Format(connectionString,
                                db[Globals.DB_DATASOURCE], db[Globals.DB_PORT], db[Globals.DB_NAME],
                                db[Globals.DB_USER], db[Globals.DB_PASSWORD])
                        : string.Format(connectionString,
                                db[Globals.DB_DATASOURCE], db[Globals.DB_PORT], db[Globals.DB_NAME]);

                if (hasConnectionStringName)
                {
                    settings.Remove(connStrNameKey);
                }
                settings[connStrKey] = connectionString;
            }

            InPlaceConfigurationSource configSource = new InPlaceConfigurationSource();
            configSource.Add(typeof(ActiveRecordBase), settings);
            configSource.IsRunningInWebApp = Convert.ToBoolean(config[Globals.GLOBAL_ACTIVERECORD_ISWEBAPP]);
            configSource.SetDebugFlag(Convert.ToBoolean(config[Globals.GLOBAL_ACTIVERECORD_DEBUG]));

            try
            {
                Assembly asmEntities = Assembly.Load(Globals.ASSEMBLY_NSN_ENTITIES);
                ActiveRecordStarter.SessionFactoryHolderCreated += ActiveRecordStarter_SessionFactoryHolderCreated;
                ActiveRecordStarter.Initialize(asmEntities, configSource);
            }
            finally
            {
                ActiveRecordStarter.SessionFactoryHolderCreated -= ActiveRecordStarter_SessionFactoryHolderCreated;
            }
        }
Exemple #17
0
 /// <summary>
 /// Hook for modifying the configuration before initialization
 /// </summary>
 /// <param name="config"></param>
 public virtual void Configure(InPlaceConfigurationSource config)
 {
 }
		/// <summary>
		/// Builds an InPlaceConfiguratioSource for the specified database.
		/// </summary>
		/// <param name="database">The database.</param>
		/// <param name="connectionString">The connection string.</param>
		/// <returns></returns>
		public static InPlaceConfigurationSource Build(DatabaseType database, string connectionString)
		{
			if (string.IsNullOrEmpty(connectionString)) throw new ArgumentNullException("connectionString");

			InPlaceConfigurationSource config = new InPlaceConfigurationSource();

			Dictionary<string,string> parameters = new Dictionary<string,string>();
			parameters["connection.provider"] = "NHibernate.Connection.DriverConnectionProvider";
			parameters["cache.use_second_level_cache"] = "false";
			parameters["proxyfactory.factory_class"] = "NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle";

			if (database == DatabaseType.MSSQLServer2000)
			{
				parameters["connection.driver_class"] = "NHibernate.Driver.SqlClientDriver";
				parameters["dialect"] = "NHibernate.Dialect.MsSql2000Dialect";
				parameters["connection.connection_string"] = connectionString;
			}
			else if (database == DatabaseType.MSSQLServer2005)
			{
				parameters["connection.driver_class"] = "NHibernate.Driver.SqlClientDriver";
				parameters["dialect"] = "NHibernate.Dialect.MsSql2005Dialect";
				parameters["connection.connection_string"] = connectionString;
			}

			config.Add(typeof(ActiveRecordBase), parameters);

			return config;
		}
        /// <summary>
        /// Initialize Active Record, and initialize the container.
        /// If <paramref name="rhinoContainerConfig"/> is <see langword="null" /> or <see cref="string.Empty">string.Empty</see>
        /// a <see cref="RhinoContainer">RhinoContainer</see> will not be initialized.
        /// </summary>
        /// <param name="rhinoContainerConfig">The configuration file to initialize a <see cref="RhinoContainer">RhinoContainer</see> 
        /// or <see langword="null" />.</param>
        /// <param name="cfg">The configuration to supply to AR</param>
        /// <param name="assemblies">The assemblies to load for NHibernate mapping files.</param>
        public void FixtureInitialize(string rhinoContainerConfig, InPlaceConfigurationSource cfg, params Assembly[] assemblies)
        {
            if (cfg == null) throw new ArgumentNullException("cfg");

            IoC.Reset();
            ActiveRecordStarter.ResetInitializationFlag();

            cfg.Add(typeof(ActiveRecordBase), CreateProperties());

            //here we either configure the IUnitOfWorkFactory appropriately (which calls ActiveRecordStarter)
            //or we configure ActiveRecordStarter ourselves

            if (!string.IsNullOrEmpty(rhinoContainerConfig))
            {
                if (!IoC.IsInitialized)
                    IoC.Initialize(new RhinoContainer(rhinoContainerConfig));
                IHandler unitOfWorkFactoryHandler = IoC.Container.Kernel
                    .GetHandler(typeof(IUnitOfWorkFactory));
                //unitOfWorkFactoryHandler
                //	.AddCustomDependencyValue("configurationSource", cfg);
                //unitOfWorkFactoryHandler
                //	.AddCustomDependencyValue("assemblies", assemblies);
                IoC.Resolve<IUnitOfWorkFactory>().Init();
            }
            else
            {
                ActiveRecordStarter.Initialize(assemblies, cfg);
            }
        }
		public override void Configure(InPlaceConfigurationSource config)
		{
			config.DefaultFlushType = DefaultFlushType.Leave;
		}
        public override bool Execute()
        {
            AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve;
            AppDomain.CurrentDomain.TypeResolve += CurrentDomain_AssemblyResolve;
            try
            {
                InPlaceConfigurationSource src = new InPlaceConfigurationSource();
                IDictionary<string,string> cfg = new Dictionary<string,string>();
                cfg[Environment.Dialect] = dialect;
                cfg[Environment.ConnectionDriver] = driver;
                cfg[Environment.ConnectionString] = connectionString;
                src.PluralizeTableNames = PloralizeTableNames;

                src.Add(typeof(ActiveRecordBase), cfg);

                List<Assembly> loadedAssemblies = new List<Assembly>();
                foreach (ITaskItem assembly in assemblies)
                {
                    Assembly asm = Assembly.LoadFrom(assembly.ItemSpec);
                    loadedAssemblies.Add(asm);
                }

                ActiveRecordStarter.ResetInitializationFlag();
                ActiveRecordStarter.Initialize(loadedAssemblies.ToArray(), src);
                Configuration configuration = ActiveRecordMediator.GetSessionFactoryHolder().GetConfiguration(typeof(ActiveRecordBase));
                new SchemaExport(configuration).Execute(true,true,false,true);
            }
            finally
            {
                AppDomain.CurrentDomain.AssemblyResolve -= CurrentDomain_AssemblyResolve;
                AppDomain.CurrentDomain.TypeResolve -= CurrentDomain_AssemblyResolve;
            }

            return true;
        }
		/// <summary>
		/// Builds an InPlaceConfiguratioSource for the specified database.
		/// </summary>
		/// <param name="database">The database.</param>
		/// <param name="connectionString">The connection string.</param>
		/// <returns></returns>
		public static InPlaceConfigurationSource Build(DatabaseType database, string connectionString)
		{
			if (string.IsNullOrEmpty(connectionString)) throw new ArgumentNullException("connectionString");

			InPlaceConfigurationSource config = new InPlaceConfigurationSource();

			Hashtable parameters = new Hashtable();
			parameters["hibernate.connection.provider"] = "NHibernate.Connection.DriverConnectionProvider";

			if (database == DatabaseType.MSSQLServer)
			{
				parameters["hibernate.connection.driver_class"] = "NHibernate.Driver.SqlClientDriver";
				parameters["hibernate.dialect"] = "NHibernate.Dialect.MsSql2000Dialect";
				parameters["hibernate.connection.connection_string"] = connectionString;
			}

			config.Add(typeof(ActiveRecordBase), parameters);

			return config;
		}
		/// <summary>
		/// Builds an <see cref="InPlaceConfigurationSource"/> for the specified database.
		/// </summary>
		/// <param name="database">The database type.</param>
		/// <param name="connectionString">The connection string.</param>
		/// <returns></returns>
		public static InPlaceConfigurationSource Build(DatabaseType database, string connectionString)
		{
			if (string.IsNullOrEmpty(connectionString)) throw new ArgumentNullException("connectionString");

			var config = new InPlaceConfigurationSource();

			var parameters = new DefaultDatabaseConfiguration().For(database);
			parameters["connection.connection_string"] = connectionString;
			config.Add(typeof(ActiveRecordBase), parameters);

			return config;
		}