当前位置: 首页>>代码示例>>C#>>正文


C# IWindsorContainer.BeginScope方法代码示例

本文整理汇总了C#中IWindsorContainer.BeginScope方法的典型用法代码示例。如果您正苦于以下问题:C# IWindsorContainer.BeginScope方法的具体用法?C# IWindsorContainer.BeginScope怎么用?C# IWindsorContainer.BeginScope使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IWindsorContainer的用法示例。


在下文中一共展示了IWindsorContainer.BeginScope方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: WindsorDependencyScope

        /// <summary>
        /// </summary>
        /// <param name="container">Windsor container.</param>
        public WindsorDependencyScope([NotNull] IWindsorContainer container)
        {
            if (container == null) throw new ArgumentNullException(nameof(container));

            this.container = container;
            this.scope = container.BeginScope();
        }
开发者ID:sharparchitecture,项目名称:Sharp-Architecture,代码行数:10,代码来源:WindsorDependencyScope.cs

示例2: Install

        public void Install(IWindsorContainer container, IConfigurationStore store)
        {
            // webAPI
            GlobalConfiguration.Configuration.Services.Replace(
                typeof(System.Web.Http.Dispatcher.IHttpControllerActivator),
                new Code.WindsorHttpControllerActivator(container));

            // MVC
            DependencyResolver.SetResolver(new Code.WindsorDependencyResolver(container));
            container.Register(Component.For<IControllerFactory>().Instance(new Code.WindsorControllerFactory(container)));

            // all classes
            container.Register(Classes.FromThisAssembly().Pick().LifestyleTransient());

            // scope
            container.Register(Component.For<IDisposable>().Named(ScopeComponentName)
                .UsingFactoryMethod((f, c) => container.BeginScope()).LifestylePerWebRequest());

            // security - user manager
            container.Register(Component.For<UserManager<ApplicationUser>>().LifestylePerWebRequest());

            // security - identity user store
            container.Register(Component.For<IUserStore<ApplicationUser>>().ImplementedBy<UserStore<ApplicationUser>>()
                .DependsOn(ServiceOverride.ForKey<DbContext>().Eq("UserStoreContext"))
                .LifestylePerWebRequest());

            // security - identity user store context
            container.Register(Component.For<DbContext>().Named("UserStoreContext").ImplementedBy<ApplicationDbContext>()
                .LifestylePerWebRequest());
        }
开发者ID:jechtom,项目名称:Expenses,代码行数:30,代码来源:WindsorConfig.cs

示例3: WindsorDependencyScope

 public WindsorDependencyScope(IWindsorContainer container)
 {
     if (container == null)
     {
         throw new ArgumentNullException("container");
     }
     _container = container;
     _scope = container.BeginScope();
 }
开发者ID:kuldeepy,项目名称:Product-Cataloge,代码行数:9,代码来源:WindsorDependencyScope.cs

示例4: WindsorDependencyScope

 public WindsorDependencyScope(IWindsorContainer container)
 {
     _container = container;
     _scope = container.BeginScope();
 }
开发者ID:MakingSense,项目名称:webapi-seed,代码行数:5,代码来源:WindsorDependencyScope.cs

示例5: BeginScope

 private static Response BeginScope(NancyContext context, IWindsorContainer container)
 {
     context.Items["LifestyleScope"] = container.BeginScope();
     return null;
 }
开发者ID:christensena,项目名称:DDDIntro,代码行数:5,代码来源:WindsorLifestyleScopePipelineStep.cs

示例6: WithSession

 private static void WithSession(
     IWindsorContainer container, Action<IDocumentSession> action)
 {
     using (container.BeginScope())
     {
         var session = container.Resolve<IDocumentSession>();
         action.Invoke(session);
         session.SaveChanges();
         container.Release(session);
     }
 }
开发者ID:dlidstrom,项目名称:EventStoreLite,代码行数:11,代码来源:Program.cs

示例7: WithEventStore

 private static void WithEventStore(IWindsorContainer container, Action<IDocumentSession, IEventStoreSession> action)
 {
     using (container.BeginScope())
     {
         var store = container.Resolve<IDocumentStore>();
         var session = container.Resolve<IDocumentSession>();
         var eventStore = container.Resolve<EventStore>();
         var eventStoreSession = eventStore.OpenSession(store, session);
         action.Invoke(session, eventStoreSession);
         eventStoreSession.SaveChanges();
         container.Release(session);
     }
 }
开发者ID:dlidstrom,项目名称:EventStoreLite,代码行数:13,代码来源:Program.cs

示例8: WindsorDependencyScope

 /// <summary>Initializes a new instance of the <see cref="WindsorDependencyScope"/> class.</summary>
 /// <param name="container">The container.</param>
 public WindsorDependencyScope(IWindsorContainer container)
 {
     this.container = container;
     this.scope = container.BeginScope();
 }
开发者ID:Wouyoshi,项目名称:projects,代码行数:7,代码来源:WindsorDependencyScope.cs

示例9: WindsorDependencyScope

 public WindsorDependencyScope(IWindsorContainer cont)
 {
     _cont = cont;
     _scope = cont.BeginScope();
 }
开发者ID:alexf2,项目名称:VendingMachine,代码行数:5,代码来源:WindsorDependencyScope.cs


注:本文中的IWindsorContainer.BeginScope方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。