Ejemplo n.º 1
0
        public static void CreateInitialData(this IAntlerConfigurator configurator, IBlogService blogService)
        {
            var userId = blogService.CreateUser(new CreatedUserDto()
            {
                Name  = "John",
                Email = "*****@*****.**"
            });

            if (!userId.HasValue)
            {
                throw new Exception("Problem while creating User");
            }

            blogService.SavePost(new SavePostDto()
            {
                Title    = "Great post about programming",
                Text     = "Programming is a ...",
                AuthodId = userId.Value
            });

            blogService.SavePost(new SavePostDto()
            {
                Title    = "Great post about fishing",
                Text     = "Fishing is a ...",
                AuthodId = userId.Value
            });
        }
Ejemplo n.º 2
0
        protected void Application_Start()
        {
            /***Example of using Antler with Castle Windsor IoC container & EntityFramework ORM & Sql CE database. See connection string below***/

            ViewEngines.Engines.Clear();
            ViewEngines.Engines.Add(new BlogViewEngine());

            AreaRegistration.RegisterAllAreas();

            WebApiConfig.Register(GlobalConfiguration.Configuration);
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);

            var container = new WindsorContainer();

            container.Register(Component.For <IBlogService>().ImplementedBy <BlogService>().LifestyleSingleton());
            container.Register(Classes.FromAssemblyNamed("Blog.Web.Common").BasedOn <BaseController>().LifestyleTransient());

            AntlerConfigurator = new AntlerConfigurator();
            AntlerConfigurator.UseWindsorContainer(container)
            .UseStorage(EntityFrameworkPlusSqlCe.Use.WithConnectionString("Data Source=|DataDirectory|\\BlogDB.sdf")
                        .WithMappings(Assembly.Load("Blog.Mappings.EF"))).CreateInitialData(container.Resolve <IBlogService>());

            ControllerBuilder.Current.SetControllerFactory(new BlogControllerFactory(container.Resolve));
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Reset current storage and apply cleanup action(mainly used in Unit/Integration testing).
 /// </summary>
 public static IAntlerConfigurator UnUseStorage(this IAntlerConfigurator configurator, Action cleanupAction)
 {
     Requires.NotNull(cleanupAction, "cleanupAction");
     UnUseStorage(configurator);
     cleanupAction();
     return(configurator);
 }
Ejemplo n.º 4
0
            public void SetUp()
            {
                Configurator = new AntlerConfigurator();
                Configurator.UseStructureMapContainer().UseStorage(NHibernateStorage.Use.WithDatabaseConfiguration(SQLiteConfiguration.Standard.InMemory()).WithMappings(From.AssemblyWithType<CountryMap>().First()));

                session = NewSessionForTesting.CreateNHibernateSession(Configurator, typeof(NHibernateStorage), UnitOfWorkSettings.Default.StorageName);
            }
Ejemplo n.º 5
0
        protected void Application_Start()
        {
            /***Example of using Antler with StructureMap IoC container & NHibernate ORM & SqlServer database. See connection string below***/

            ViewEngines.Engines.Clear();
            ViewEngines.Engines.Add(new BlogViewEngine());

            AreaRegistration.RegisterAllAreas();

            WebApiConfig.Register(GlobalConfiguration.Configuration);
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);

            var container = new Container(x =>
            {
                x.For <IBlogService>().Use <BlogService>().Singleton();
                x.Scan(s =>
                {
                    s.AddAllTypesOf(typeof(BaseController));
                    s.Assembly("Blog.Web.Common");
                });
            });

            const string connectionString = "Data Source=(localdb)\\Projects;Initial Catalog=Antler;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False";

            AntlerConfigurator = new AntlerConfigurator();
            AntlerConfigurator.UseStructureMapContainer(container)
            .UseStorage(NHibernateStorage.Use.WithDatabaseConfiguration(MsSqlConfiguration.MsSql2008.ConnectionString(connectionString))
                        .WithMappings(Assembly.Load("Blog.Mappings.NH")).WithCommandToTryToApplyOnServer(DbProviderFactories.GetFactory("System.Data.SqlClient"), connectionString, "CREATE DATABASE Antler")
                        .WithRegeneratedSchema(true)).CreateInitialData(container.GetInstance <IBlogService>());

            ControllerBuilder.Current.SetControllerFactory(new BlogControllerFactory(container.GetInstance));
        }
Ejemplo n.º 6
0
        protected void Application_Start()
        {
            /***Example of using Antler with Castle Windsor IoC container & Linq2Db ORM & SqlServer database. See connection string below***/

            /***! Plus we configure EntityFramework targeted on the same database,
             *    just to use EF's functionallity to generate database & tables based on mappings(Linq2Db unable to do it) !***/

            ViewEngines.Engines.Clear();
            ViewEngines.Engines.Add(new BlogViewEngine());

            AreaRegistration.RegisterAllAreas();

            WebApiConfig.Register(GlobalConfiguration.Configuration);
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);

            var container = new WindsorContainer();

            container.Register(Component.For <IBlogService>().ImplementedBy <Linq2DbBlogService>());
            container.Register(Classes.FromAssemblyNamed("Blog.Web.Common").BasedOn <BaseController>().LifestyleTransient());

            const string connectionString = "Data Source=(localdb)\\Projects;Initial Catalog=Antler;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False";

            AntlerConfigurator = new AntlerConfigurator();
            AntlerConfigurator.UseWindsorContainer(container)
            .UseStorage(EntityFrameworkStorage.Use.WithConnectionString(connectionString).WithRecreatedDatabase(true).WithMappings(Assembly.Load("Blog.Mappings.EF")), "JustToGenerateStuff")
            .UseStorage(Linq2DbStorage.Use(connectionString)).CreateInitialData(container.Resolve <IBlogService>());

            ControllerBuilder.Current.SetControllerFactory(new BlogControllerFactory(container.Resolve));
        }
Ejemplo n.º 7
0
        protected void Application_Start()
        {
            /***Example of using Antler with StructureMap container & MongoDb . See connection string below***/

            ViewEngines.Engines.Clear();
            ViewEngines.Engines.Add(new BlogViewEngine());

            AreaRegistration.RegisterAllAreas();

            WebApiConfig.Register(GlobalConfiguration.Configuration);
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);

            var service = new BlogService();

            var container = new Container(x =>
            {
                x.For<IBlogService>().Use<BlogService>().Singleton();
                x.Scan(s =>
                {
                    s.AddAllTypesOf(typeof(BaseController));
                    s.Assembly("Blog.Web.Common");
                });
            });

            AntlerConfigurator = new AntlerConfigurator();
            AntlerConfigurator.UseStructureMapContainer(container)
                .UseStorage(MongoDbStorage.Use("mongodb://localhost:27017", "Antler")
                    .WithRecreatedDatabase(true).WithIdentityGenerator(()=>new Random().Next(Int32.MinValue, Int32.MaxValue))).CreateInitialData(container.GetInstance<IBlogService>());

            ControllerBuilder.Current.SetControllerFactory(new BlogControllerFactory(t => Activator.CreateInstance(t, service)));
        }
Ejemplo n.º 8
0
        protected void Application_Start()
        {
            /***Example of using Antler with Castle Windsor IoC container & Linq2Db ORM & SqlServer database. See connection string below***/

            /***! Plus we configure EntityFramework targeted on the same database,
                  just to use EF's functionallity to generate database & tables based on mappings(Linq2Db unable to do it) !***/

            ViewEngines.Engines.Clear();
            ViewEngines.Engines.Add(new BlogViewEngine());

            AreaRegistration.RegisterAllAreas();

            WebApiConfig.Register(GlobalConfiguration.Configuration);
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);

            var container = new WindsorContainer();
            container.Register(Component.For<IBlogService>().ImplementedBy<Linq2DbBlogService>());
            container.Register(Classes.FromAssemblyNamed("Blog.Web.Common").BasedOn<BaseController>().LifestyleTransient());

            const string connectionString = "Data Source=(localdb)\\Projects;Initial Catalog=Antler;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False";
            AntlerConfigurator = new AntlerConfigurator();
            AntlerConfigurator.UseWindsorContainer(container)
                              .UseStorage(EntityFrameworkStorage.Use.WithConnectionString(connectionString).WithRecreatedDatabase(true).WithMappings(Assembly.Load("Blog.Mappings.EF")), "JustToGenerateStuff")
                              .UseStorage(Linq2DbStorage.Use(connectionString)).CreateInitialData(container.Resolve<IBlogService>());

            ControllerBuilder.Current.SetControllerFactory(new BlogControllerFactory(container.Resolve));
        }
Ejemplo n.º 9
0
        protected void Application_Start()
        {
            /***Example of using Antler with StructureMap container & MongoDb . See connection string below***/

            ViewEngines.Engines.Clear();
            ViewEngines.Engines.Add(new BlogViewEngine());

            AreaRegistration.RegisterAllAreas();

            WebApiConfig.Register(GlobalConfiguration.Configuration);
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);

            var service = new BlogService();

            var container = new Container(x =>
            {
                x.For <IBlogService>().Use <BlogService>().Singleton();
                x.Scan(s =>
                {
                    s.AddAllTypesOf(typeof(BaseController));
                    s.Assembly("Blog.Web.Common");
                });
            });

            AntlerConfigurator = new AntlerConfigurator();
            AntlerConfigurator.UseStructureMapContainer(container)
            .UseStorage(MongoDbStorage.Use("mongodb://localhost:27017", "Antler")
                        .WithRecreatedDatabase(true).WithIdentityGenerator(() => new Random().Next(Int32.MinValue, Int32.MaxValue))).CreateInitialData(container.GetInstance <IBlogService>());

            ControllerBuilder.Current.SetControllerFactory(new BlogControllerFactory(t => Activator.CreateInstance(t, service)));
        }
Ejemplo n.º 10
0
        protected void Application_Start()
        {
            /***Example of using Antler with StructureMap IoC container & NHibernate ORM & SqlServer database. See connection string below***/

            ViewEngines.Engines.Clear();
            ViewEngines.Engines.Add(new BlogViewEngine());

            AreaRegistration.RegisterAllAreas();

            WebApiConfig.Register(GlobalConfiguration.Configuration);
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);

            var container = new Container(x =>
                {
                    x.For<IBlogService>().Use<BlogService>().Singleton();
                    x.Scan(s =>
                    {
                        s.AddAllTypesOf(typeof(BaseController));
                        s.Assembly("Blog.Web.Common");
                    });
                });

            const string connectionString = "Data Source=(localdb)\\Projects;Initial Catalog=Antler;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False";
            AntlerConfigurator = new AntlerConfigurator();
            AntlerConfigurator.UseStructureMapContainer(container)
                              .UseStorage(NHibernateStorage.Use.WithDatabaseConfiguration(MsSqlConfiguration.MsSql2008.ConnectionString(connectionString))
                                            .WithMappings(Assembly.Load("Blog.Mappings.NH")).WithCommandToTryToApplyOnServer(DbProviderFactories.GetFactory("System.Data.SqlClient"), connectionString, "CREATE DATABASE Antler")
                                            .WithRegeneratedSchema(true)).CreateInitialData(container.GetInstance<IBlogService>());

            ControllerBuilder.Current.SetControllerFactory(new BlogControllerFactory(container.GetInstance));
        }
Ejemplo n.º 11
0
        public static void ResetNHibernateSession(IAntlerConfigurator configurator, ISession session, string storageName)
        {
            session.Dispose();
            var sessionScopeFactory = (ISessionScopeFactoryEx)configurator.Configuration.Container.Get <ISessionScopeFactory>(storageName);

            sessionScopeFactory.ResetSession();
        }
Ejemplo n.º 12
0
        /** <summary>
         * Set UnitOfWork settings that will be used by default.
         * For example, to disable commits or to rollback transaction on UnitOfWork completion(could be useful when writing Integration tests)
         * </summary>*/
        public static IAntlerConfigurator SetUnitOfWorkDefaultSettings(this IAntlerConfigurator configurator,
                                                                       UnitOfWorkSettings settings)
        {
            Requires.NotNull(settings, "settings");

            UnitOfWorkSettings.Default = settings;
            return(configurator);
        }
Ejemplo n.º 13
0
            public void SetUp()
            {
                Configurator = new AntlerConfigurator();

                var connectionString = ConfigurationManager.AppSettings["ConnectionString"];
                Configurator.UseWindsorContainer()
                            .UseStorage(EntityFrameworkStorage.Use.WithConnectionString(connectionString)
                                                                   .WithMappings(From.AssemblyWithType<CountryMap>().First())
                                                                   .WithRecreatedDatabase(true), "JustToGenerateStuff")
                            .UseStorage(Linq2DbStorage.Use(connectionString));
            }
Ejemplo n.º 14
0
            public void SetUp()
            {
                Configurator = new AntlerConfigurator();

                Configurator.UseWindsorContainer()
                .UseStorage(MongoDbStorage.Use("mongodb://localhost:27017", "AntlerTest")
                            .WithRecreatedDatabase(true)
                            .WithIdentityGenerator(() => new Random().Next(1, int.MaxValue))
                            .WithEnsuredIndexes(MongoDbIndexBuilder.Add <Employee>(IndexKeys <Employee> .Ascending(_ => _.Id), IndexOptions <Employee> .SetUnique(true))
                                                .ThenAdd <Team>(IndexKeys <Team> .Ascending(_ => _.Id), IndexOptions <Employee> .SetUnique(true))));
            }
Ejemplo n.º 15
0
            public void SetUp()
            {
                Configurator = new AntlerConfigurator();

                Configurator.UseWindsorContainer()
                            .UseStorage(MongoDbStorage.Use("mongodb://localhost:27017", "AntlerTest")
                                                      .WithRecreatedDatabase(true)
                                                      .WithIdentityGenerator(() => new Random().Next(1, int.MaxValue))
                                                      .WithEnsuredIndexes(MongoDbIndexBuilder.Add<Employee>(IndexKeys<Employee>.Ascending(_ => _.Id), IndexOptions<Employee>.SetUnique(true))
                                                                          .ThenAdd<Team>(IndexKeys<Team>.Ascending(_ => _.Id), IndexOptions<Employee>.SetUnique(true))));
            }
Ejemplo n.º 16
0
            public void SetUp()
            {
                Configurator = new AntlerConfigurator();

                var connectionString = ConfigurationManager.AppSettings["ConnectionString"];

                Configurator.UseWindsorContainer()
                .UseStorage(EntityFrameworkStorage.Use.WithConnectionString(connectionString)
                            .WithMappings(From.AssemblyWithType <CountryMap>().First())
                            .WithRecreatedDatabase(true), "JustToGenerateStuff")
                .UseStorage(Linq2DbStorage.Use(connectionString));
            }
Ejemplo n.º 17
0
        /// <summary>
        /// Start to configure ORM/database using this method.
        /// </summary>
        public static IAntlerConfigurator UseStorage(this IAntlerConfigurator configurator, IStorage storage, string storageName = null)
        {
            Requires.NotNull(storage, "storage", "Storage can't be null");
            Assumes.True <ContainerRequiredException>(configurator.HasContainer(), "Please choose some IoC container(e.g. use adapters for Castle Windsor, StructureMap or Built-in container)");

            storageName = storageName ?? UnitOfWorkSettings.Default.StorageName;

            Assumes.True(!configurator.Configuration.Container.Has <ISessionScopeFactory>(storageName), "Storage with the same name {0} already has been configured. Try to use another name or specify name explicitly", storageName);

            UnitOfWork.SessionScopeFactoryExtractor = s => configurator.Configuration.Container.Get <ISessionScopeFactory>(s);
            storage.Configure(new DomainConfigurator(configurator.Configuration).Named(storageName));
            return(configurator);
        }
Ejemplo n.º 18
0
            public void SetUp()
            {
                Configurator = new AntlerConfigurator();

                const string connectionString     = "Data Source=TestDB.sdf";
                var          assemblyWithMappings = From.AssemblyWithType <CountryMap>().First();

                Configurator.UseWindsorContainer()
                .UseStorage(typeof(T) == typeof(LazyLoading)
                                            ? EntityFrameworkPlusSqlCe.Use.WithConnectionString(connectionString)
                            .WithMappings(assemblyWithMappings).WithRecreatedDatabase(true)
                                            : EntityFrameworkPlusSqlCe.Use.WithoutLazyLoading()
                            .WithConnectionString(connectionString)
                            .WithMappings(assemblyWithMappings).WithRecreatedDatabase(true));
            }
Ejemplo n.º 19
0
            public void SetUp()
            {
                Configurator = new AntlerConfigurator();

                var connectionString     = ConfigurationManager.AppSettings["ConnectionString"];
                var assemblyWithMappings = From.AssemblyWithType <CountryMap>().First();

                Configurator.UseStructureMapContainer()
                .UseStorage(typeof(T) == typeof(LazyLoading)
                                            ? EntityFrameworkStorage.Use.WithConnectionString(connectionString)
                            .WithMappings(assemblyWithMappings).WithRecreatedDatabase(true)
                                            : EntityFrameworkStorage.Use.WithoutLazyLoading()
                            .WithConnectionString(connectionString)
                            .WithMappings(assemblyWithMappings).WithRecreatedDatabase(true));
            }
Ejemplo n.º 20
0
        public static ISession CreateNHibernateSession(IAntlerConfigurator configurator, Type storageType, string storageName)
        {
            var nhConfigurationResult = storageType.AsStaticMembersDynamicWrapper().LatestConfigurationResult;

            var session = nhConfigurationResult.SessionFactory.OpenSession();

            var schemaExport = new SchemaExport(nhConfigurationResult.Configuration);
            schemaExport.Drop(true, true);
            schemaExport.Execute(false, true, false, session.Connection, null);

            var sessionScopeFactory = (ISessionScopeFactoryEx)configurator.Configuration.Container.Get<ISessionScopeFactory>(storageName);
            sessionScopeFactory.SetSession(session);

            return session;
        }
Ejemplo n.º 21
0
        public static ISession CreateNHibernateSession(IAntlerConfigurator configurator, Type storageType, string storageName)
        {
            var nhConfigurationResult = storageType.AsStaticMembersDynamicWrapper().LatestConfigurationResult;

            var session = nhConfigurationResult.SessionFactory.OpenSession();

            var schemaExport = new SchemaExport(nhConfigurationResult.Configuration);

            schemaExport.Drop(true, true);
            schemaExport.Execute(false, true, false, session.Connection, null);

            var sessionScopeFactory = (ISessionScopeFactoryEx)configurator.Configuration.Container.Get <ISessionScopeFactory>(storageName);

            sessionScopeFactory.SetSession(session);

            return(session);
        }
Ejemplo n.º 22
0
        protected void Application_Start()
        {
            /***Example of using Antler with BuiltIn container & EntityFramework ORM & SqlServer database . See connection string below***/

            ViewEngines.Engines.Clear();
            ViewEngines.Engines.Add(new BlogViewEngine());

            AreaRegistration.RegisterAllAreas();

            WebApiConfig.Register(GlobalConfiguration.Configuration);
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);

            var service = new BlogService();

            AntlerConfigurator = new AntlerConfigurator();
            AntlerConfigurator.UseBuiltInContainer()
            .UseStorage(EntityFrameworkStorage.Use.WithConnectionString("Data Source=(localdb)\\Projects;Initial Catalog=Antler;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False").WithLazyLoading().WithDatabaseInitializer(new DropCreateDatabaseAlways <DataContext>())
                        .WithMappings(Assembly.Load("Blog.Mappings.EF"))).CreateInitialData(service);

            ControllerBuilder.Current.SetControllerFactory(new BlogControllerFactory(t => Activator.CreateInstance(t, service)));
        }
Ejemplo n.º 23
0
        protected void Application_Start()
        {
            /***Example of using Antler with BuiltIn container & EntityFramework ORM & SqlServer database . See connection string below***/

            ViewEngines.Engines.Clear();
            ViewEngines.Engines.Add(new BlogViewEngine());

            AreaRegistration.RegisterAllAreas();

            WebApiConfig.Register(GlobalConfiguration.Configuration);
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);

            var service = new BlogService();

            AntlerConfigurator = new AntlerConfigurator();
            AntlerConfigurator.UseBuiltInContainer()
                              .UseStorage(EntityFrameworkStorage.Use.WithConnectionString("Data Source=(localdb)\\Projects;Initial Catalog=Antler;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False").WithLazyLoading().WithDatabaseInitializer(new DropCreateDatabaseAlways<DataContext>())
                                                                  .WithMappings(Assembly.Load("Blog.Mappings.EF"))).CreateInitialData(service);

            ControllerBuilder.Current.SetControllerFactory(new BlogControllerFactory(t => Activator.CreateInstance(t, service)));
        }
Ejemplo n.º 24
0
        protected void Application_Start()
        {
            /***Example of using Antler with Castle Windsor IoC container & EntityFramework ORM & Sql CE database. See connection string below***/

            ViewEngines.Engines.Clear();
            ViewEngines.Engines.Add(new BlogViewEngine());

            AreaRegistration.RegisterAllAreas();

            WebApiConfig.Register(GlobalConfiguration.Configuration);
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);

            var container = new WindsorContainer();
            container.Register(Component.For<IBlogService>().ImplementedBy<BlogService>().LifestyleSingleton());
            container.Register(Classes.FromAssemblyNamed("Blog.Web.Common").BasedOn<BaseController>().LifestyleTransient());

            AntlerConfigurator = new AntlerConfigurator();
            AntlerConfigurator.UseWindsorContainer(container)
                              .UseStorage(EntityFrameworkPlusSqlCe.Use.WithConnectionString("Data Source=|DataDirectory|\\BlogDB.sdf")
                                                                  .WithMappings(Assembly.Load("Blog.Mappings.EF"))).CreateInitialData(container.Resolve<IBlogService>());

            ControllerBuilder.Current.SetControllerFactory(new BlogControllerFactory(container.Resolve));
        }
Ejemplo n.º 25
0
 /// <summary>
 /// Reset UnitOfWork default settings(mainly used in Unit/Integration testing).
 /// </summary>
 public static IAntlerConfigurator UnSetUnitOfWorkDefaultSettings(this IAntlerConfigurator configurator)
 {
     UnitOfWorkSettings.Default = new UnitOfWorkSettings();
     return(configurator);
 }
Ejemplo n.º 26
0
 public static void ResetNHibernateSession(IAntlerConfigurator configurator, ISession session, string storageName)
 {
     session.Dispose();
     var sessionScopeFactory = (ISessionScopeFactoryEx)configurator.Configuration.Container.Get<ISessionScopeFactory>(storageName);
     sessionScopeFactory.ResetSession();
 }
Ejemplo n.º 27
0
 public static bool HasContainer(this IAntlerConfigurator configurator)
 {
     return(configurator.Configuration.Container != null);
 }
Ejemplo n.º 28
0
 public static IAntlerConfigurator UseBuiltInContainer(this IAntlerConfigurator nodeConfigurator)
 {
     ((IAntlerConfiguratorEx)nodeConfigurator).SetContainerAdapter(new BuiltInContainer());
     return(nodeConfigurator);
 }
Ejemplo n.º 29
0
 /// <summary>
 /// Reset current storage(mainly used in Unit/Integration testing).
 /// </summary>
 public static IAntlerConfigurator UnUseStorage(this IAntlerConfigurator configurator)
 {
     UnitOfWork.SessionScopeFactoryExtractor = null;
     return(configurator);
 }
Ejemplo n.º 30
0
 /// <summary>
 /// Use specified Castle Windsor IoC container.
 /// </summary>
 public static IAntlerConfigurator UseWindsorContainer(this IAntlerConfigurator configurator, IWindsorContainer container)
 {
     ((IAntlerConfiguratorEx)configurator).SetContainerAdapter(new WindsorContainerAdapter(container));
     return(configurator);
 }
Ejemplo n.º 31
0
 public void SetUp()
 {
     var connectionString = ConfigurationManager.AppSettings["ConnectionString"];
     Configurator = new AntlerConfigurator();
     Configurator.UseWindsorContainer().UseStorage(NHibernateStorage.Use.WithDatabaseConfiguration(MsSqlConfiguration.MsSql2008.ConnectionString(connectionString)).WithCommandToTryToApplyOnServer(DbProviderFactories.GetFactory("System.Data.SqlClient"), connectionString, "CREATE DATABASE AntlerTest").WithRegeneratedSchema(true).WithMappings(From.AssemblyWithType<CountryMap>().First()));
 }
Ejemplo n.º 32
0
 /// <summary>
 /// Use specified StructureMap IoC container.
 /// </summary>
 public static IAntlerConfigurator UseStructureMapContainer(this IAntlerConfigurator configurator, IContainer container)
 {
     ((IAntlerConfiguratorEx)configurator).SetContainerAdapter(new StructureMapContainerAdapter(container));
     return(configurator);
 }
Ejemplo n.º 33
0
 /// <summary>
 /// Reset current IoC container(mainly used in Unit/Integration testing).
 /// </summary>
 public static IAntlerConfigurator UnUseContainer(this IAntlerConfigurator nodeConfigurator)
 {
     ((IAntlerConfiguratorEx)nodeConfigurator).UnSetContainerAdapter();
     return(nodeConfigurator);
 }