public static Configuration Initialize()
        {
            INHibernateConfigurationCache cache = new NHibernateConfigurationFileCache();

            var mappingAssemblies = new[] {
                typeof(ActionConfirmation<>).Assembly.GetName().Name
            };

            var configuration = cache.LoadConfiguration(CONFIG_CACHE_KEY, null, mappingAssemblies);

            if (configuration == null) {
                configuration = new Configuration();

                configuration
                    .Proxy(p => p.ProxyFactoryFactory<DefaultProxyFactoryFactory>())
                    .DataBaseIntegration(db => {
                        db.ConnectionStringName = "DonSharpLiteConnectionString";
                        db.Dialect<MsSql2008Dialect>();
                    })
                    .AddAssembly(typeof(ActionConfirmation<>).Assembly)
                    .CurrentSessionContext<LazySessionContext>();

                var mapper = new ConventionModelMapper();
                mapper.WithConventions(configuration);

                cache.SaveConfiguration(CONFIG_CACHE_KEY, configuration);
            }

            return configuration;
        }
        public static IConfigurationProvider CreateConfigurationProvider()
        {
            var configFilePath = PathHelpers.InCurrentAppDomain(Constants.NHibernateConfigFileName);
            var configuration = new Configuration();
            configuration.Configure(configFilePath);

            var mapper = new ConventionModelMapper();
            mapper.WithConventions();
            mapper.WithMappings(configuration);

            return new ConfigurationProvider(configuration);
        }
        public void CanGenerateMappingDoc()
        {
            // Need a separate config so we can get hold of the mapper after using it.
            // If we use the existing config we get a duplicate mapping exception.
            var config = NHibernateInitializer.CreateConfiguration();

            var mapper = new ConventionModelMapper();
            mapper.WithConventions(config);

            var mapping = mapper.CompileMappingFor(typeof(Entity).Assembly.GetExportedTypes());
            var x = mapping.AsString();
            File.WriteAllText("../../NHibernateTests/Output.xml", x);
        }
        public static Configuration Initialize() {
            Configuration configuration = new Configuration();

            configuration
                .Proxy(p => p.ProxyFactoryFactory<DefaultProxyFactoryFactory>())
                .DataBaseIntegration(db => {
                    db.ConnectionStringName = "CaTSConnectionString";
                    db.Dialect<MsSql2008Dialect>();
                })
                .AddAssembly(typeof(ActionConfirmation<>).Assembly)
                .CurrentSessionContext<LazySessionContext>();

            ConventionModelMapper mapper = new ConventionModelMapper();
            mapper.WithConventions(configuration);

            return configuration;
        }
        public static Configuration Initialize()
        {
            var configuration = new Configuration();

            configuration
                .Proxy(p => p.ProxyFactoryFactory<DefaultProxyFactoryFactory>())
                .DataBaseIntegration(db =>
                                         {
                                             db.ConnectionStringName = "DevelopmentStack";
                                             db.Dialect<MsSql2008Dialect>();
                                             db.KeywordsAutoImport = Hbm2DDLKeyWords.AutoQuote;
                                         })
                .AddAssembly(typeof (Stack).Assembly)
                .CurrentSessionContext<LazySessionContext>();

            ConventionModelMapper mapper = new ConventionModelMapper();
            mapper.WithConventions(configuration);

            return configuration;
        }
        public static Configuration Initialize()
        {
            var cache = new NHibernateConfigurationFileCache();

            var mappingAssemblies = new[] {
                typeof(Entity).Assembly.GetName().Name
            };

            var configuration = cache.LoadConfiguration(CONFIG_CACHE_KEY, null, mappingAssemblies);

            if (configuration == null) {

                configuration = CreateConfiguration();

                var mapper = new ConventionModelMapper();
                mapper.WithConventions(configuration);

                cache.SaveConfiguration(CONFIG_CACHE_KEY, configuration);
            }

            return configuration;
        }