Esempio n. 1
0
        static void Main()
        {
            var mappingContributors = new IMappingConfigurationContributor[]
            {
                new SutekiShopMappingConfiguration(),
                new StockControlMappingConfiguration()
            };

            var configurationBuilder = new FluentNHibernateConfigurationBuilder(mappingContributors);
            var configuration        = configurationBuilder.BuildConfiguration(
                MsSqlConfiguration.MsSql2005.ConnectionString(
                    c => c.FromConnectionStringWithKey("SutekiShopConnectionString")));

            var databaseManager = new DatabaseManager(configuration);

            if (databaseManager.DatabaseExists)
            {
                Console.WriteLine("Dropping Database {0}", databaseManager.GetDbName());
                databaseManager.DropDatabase();
            }
            Console.WriteLine("Creating Database {0}", databaseManager.GetDbName());
            databaseManager.CreateDatabase();

            Console.WriteLine("Inserting Static Data");
            new StaticDataGenerator(configuration).Insert();

            Console.WriteLine("Successfully Created Database {0}", databaseManager.GetDbName());
        }
Esempio n. 2
0
        public void SetUp()
        {
            var configurationBuilder = new FluentNHibernateConfigurationBuilder(new[] { new SutekiShopMappingConfiguration() });

            configuration = configurationBuilder.BuildConfiguration(
                MsSqlConfiguration.MsSql2005.ConnectionString(
                    c => c.FromConnectionStringWithKey("SutekiShopConnectionString")));

            databaseManager = new DatabaseManager(configuration);
        }