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


C# Castle.AddFacility方法代码示例

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


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

示例1: Install

        /// <summary>
        /// Performs the installation in the <see cref="T:Castle.Windsor.IWindsorContainer"/>.
        /// </summary>
        /// <param name="container">The container.</param>
        /// <param name="store">The configuration store.</param>
        public void Install(Castle.Windsor.IWindsorContainer container, Castle.MicroKernel.SubSystems.Configuration.IConfigurationStore store)
        {
            container.AddFacility<LoggingFacility>(f =>
                    f.LogUsing(LoggerImplementation.Log4net)
                    .WithConfig("D:\\Home\\PersonalDevel\\log4net-Playground.config"));
            //change this to something better or even use App config

            container.AddFacility<TypedFactoryFacility>();
            container.AddFacility<PersistenceFacility>();
        }
开发者ID:Detroier,项目名称:playground,代码行数:15,代码来源:FacilitiesInstaller.cs

示例2: Install

        public void Install(Castle.Windsor.IWindsorContainer container, Castle.MicroKernel.SubSystems.Configuration.IConfigurationStore store)
        {
            container.AddFacility<AutoTxFacility>();
            container.Register(Component.For<INHibernateInstaller>().ImplementedBy<NHibernateInstaller>());//.LifeStyle.Singleton);

            var ni = container.Resolve<INHibernateInstaller>();
            var t = container.ResolveAll<IInterceptor>();

            //container.AddFacility<NHibernateFacility>();
            container.AddFacility<NHibernateFacility>(f => f.DefaultLifeStyle = DefaultSessionLifeStyleOption.SessionPerWebRequest);

            container.Install(FromAssembly.Containing<PersonRepository>());
        }
开发者ID:robgray,项目名称:NHibernateFacilityMVC4Test,代码行数:13,代码来源:PersistenceInstaller.cs

示例3: Install

        public void Install(Castle.Windsor.IWindsorContainer container, Castle.MicroKernel.SubSystems.Configuration.IConfigurationStore store)
        {
            container.Register(
                        Classes.FromAssemblyInDirectory(new AssemblyFilter(HttpRuntime.BinDirectory, "Application.Web.*"))
                        .BasedOn<IController>()
                        .LifestyleTransient(),

                        Classes.FromAssemblyInDirectory(new AssemblyFilter(HttpRuntime.BinDirectory, "Application.Web.*"))
                        .BasedOn<IHttpController>()
                        .LifestyleTransient()
                                );
            container.Register(
                        Component.For<IQueryableUnitOfWork, UnitOfWork>().ImplementedBy<UnitOfWork>(),
                        Component.For<IProfileRepository, ProfileRepository>().ImplementedBy<ProfileRepository>(),
                        Component.For<IAddressRepository, AddressRepository>().ImplementedBy<AddressRepository>(),
                        Component.For<IAddressTypeRepository, AddressTypeRepository>().ImplementedBy<AddressTypeRepository>(),
                        Component.For<IPhoneTypeRepository, PhoneTypeRepository>().ImplementedBy<PhoneTypeRepository>(),
                        Component.For<IPhoneRepository, PhoneRepository>().ImplementedBy<PhoneRepository>(),
                        Component.For<IProfileAddressRepository, ProfileAddressRepository>().ImplementedBy<ProfileAddressRepository>(),
                        Component.For<IProfilePhoneRepository, ProfilePhoneRepository>().ImplementedBy<ProfilePhoneRepository>().LifestyleSingleton(),
                        Component.For<IContactManager>().ImplementedBy<ContactManager>()
                        );

            container.AddFacility<LoggingFacility>(f => f.UseLog4Net());

            LoggerFactory.SetCurrent(new TraceSourceLogFactory());
            EntityValidatorFactory.SetCurrent(new DataAnnotationsEntityValidatorFactory());
        }
开发者ID:khoacoi,项目名称:WebAppWithEFAndCastle,代码行数:28,代码来源:DependencyConventions.cs

示例4: Install

        public void Install(Castle.Windsor.IWindsorContainer container, Castle.MicroKernel.SubSystems.Configuration.IConfigurationStore store)
        {
            container.AddFacility(new LoggingFacility(LoggerImplementation.Log4net, "log4net.config"));
            container.AddFacility(new StartableFacility());

            container.Register(
                Component.For<IDomainEventHandlerCatalog, ICommandHandlerCatalog>().ImplementedBy<CastleFasterflectHandlerCatalog>(),
                Component.For<ICommandDispatcher>().ImplementedBy<CommandDispatcher>(),
                Component.For<IDomainEventDispatcher>().ImplementedBy<DomainEventDispatcher>(),
                Component.For<UnitOfWork>().ImplementedBy<UnitOfWork>());

            container.Register(
                Component.For<AggregateRootFactory>().UsingFactoryMethod(() => new AggregateRootFactory()));

            container.Register(
                Component.For<IEventsStore>().ImplementedBy<SqlEventsStore>()
                        .DependsOn(Property.ForKey("configurationFileName").Eq(HostingEnvironment.MapPath("~/NhEventStoreConfiguration.xml"))));
        }
开发者ID:alkampfergit,项目名称:ShuppanButsu,代码行数:18,代码来源:WebBootstrap.cs

示例5: Install

 public void Install(Castle.Windsor.IWindsorContainer container, Castle.MicroKernel.SubSystems.Configuration.IConfigurationStore store)
 {
     container
     .AddFacility<TransactionFacility>("autoTxFacility")
     .AddFacility<NHibernateFacility>("nhibnernateFacility", cfg => cfg.ConfigurationBuilder<FluentConfigurationBuilder>())
     .Register(
         Component.For<ISurveyRepository>()
             .ImplementedBy<NHibernateSurveyRepository>()
             .LifeStyle.Transient
     )
     ;
 }
开发者ID:oharab,项目名称:OpenSurvey,代码行数:12,代码来源:NHibernateInstaller.cs

示例6: Install

        public void Install(Castle.Windsor.IWindsorContainer container, Castle.MicroKernel.SubSystems.Configuration.IConfigurationStore store)
        {
            container.AddFacility<TypedFactoryFacility>();

            container.Register(Classes.FromThisAssembly().BasedOn(typeof(IHub)).LifestyleTransient());
            var signalRDependencyResolver = new SignalRDependencyResolver(container);
            Microsoft.AspNet.SignalR.GlobalHost.DependencyResolver = signalRDependencyResolver;

            container.Register(
                Component.For<IUserServiceFactory>().AsFactory()
            );
        }
开发者ID:kejto,项目名称:SignalR-Server,代码行数:12,代码来源:WindosrIoC.cs

示例7: Install

        public void Install(Castle.Windsor.IWindsorContainer container, Castle.MicroKernel.SubSystems.Configuration.IConfigurationStore store)
        {
            container.Register(
                Component.For(typeof(ICacheProvider<>))
                .ImplementedBy(typeof(CacheProvider<>))
                .LifeStyle.Transient);

            container.AddFacility<TypedFactoryFacility>();

            container.Register(
                Component.For<ICacheDependencyFactory>()
                .AsFactory());
        }
开发者ID:Appacts,项目名称:mobile-analytics-server,代码行数:13,代码来源:InstallCache.cs

示例8: Install

        public void Install(Castle.Windsor.IWindsorContainer container, Castle.MicroKernel.SubSystems.Configuration.IConfigurationStore store)
        {
            var assem = Assembly.GetExecutingAssembly();
            container.Register(Classes.FromAssembly(assem).BasedOn<ApiController>().LifestyleTransient());

            container.AddFacility<TypedFactoryFacility>();

            container.Register(

                Component.For<IUserServiceFactory>().AsFactory(),
                
                Component.For<IUserService>().ImplementedBy<Shared.Membership.Service.UserService>().LifeStyle.PerWebRequest,
                Component.For<IDataBaseAccess>().ImplementedBy<DataBaseAccess>().LifeStyle.PerWebRequest,
                Component.For<IDataBaseSettings>().ImplementedBy<DataBaseSettings>().LifeStyle.PerWebRequest,

                Component.For<ISnapshotsRepository>().ImplementedBy<SnapshotsRepository>().LifeStyle.PerWebRequest,
                
                Component.For<IDomainHandler<SnapshotsGet>>().ImplementedBy<SnapshotsGetHandlerPersistance>().LifeStyle.PerWebRequest
                
                );
        }
开发者ID:kejto,项目名称:DataStore-BDD,代码行数:21,代码来源:WindosrIoC.cs

示例9: Install

        public void Install(Castle.Windsor.IWindsorContainer container, Castle.MicroKernel.SubSystems.Configuration.IConfigurationStore store)
        {
            container.Kernel.Resolver.AddSubResolver(new ArrayResolver(container.Kernel, true));

            // PerCall setup
            container.AddFacility<WcfFacility>()
                .Register(

                    //WCF services
                    Component.For<IOrderService>()
                        .ImplementedBy<OrderService>()
                        .LifeStyle.ApplyLifeStyle(lifestyleApplier),

                    //CQRSLite stuff
                    Component.For<OrderCommandHandlers>().LifeStyle.ApplyLifeStyle(lifestyleApplier),
                    Component.For<IEventPublisher>().ImplementedBy<BusEventPublisher>().LifeStyle.Singleton,
                    Component.For<IInterProcessBus>().ImplementedBy<InterProcessBus>().LifeStyle.Singleton,
                    Component.For<ISession>().ImplementedBy<Session>().LifeStyle.ApplyLifeStyle(lifestyleApplier),
                    Component.For<IEventStore>().ImplementedBy<InMemoryEventStore>().LifeStyle.Singleton,
                    Component.For<IReadModelRepository>().ImplementedBy<ReadModelRepository>().LifeStyle.Singleton,
                    Component.For<IBusEventHandler>().ImplementedBy<OrderCreatedEventHandler>()
                        .Named("OrderCreatedEventHandler").LifeStyle.Singleton,
                    Component.For<IBusEventHandler>().ImplementedBy<OrderAddressChangedEventHandler>()
                        .Named("OrderAddressChangedEventHandler").LifeStyle.Singleton,
                    Component.For<IBusEventHandler>().ImplementedBy<OrderDeletedEventHandler>()
                        .Named("OrderDeletedEventHandler").LifeStyle.Singleton,
                    Component.For<IRepository>().UsingFactoryMethod(
                        kernel =>
                        {
                            return
                                new CacheRepository(
                                    new Repository(kernel.Resolve<IEventStore>(), kernel.Resolve<IEventPublisher>()),
                                    kernel.Resolve<IEventStore>());
                        })

            );
        }
开发者ID:Carevel,项目名称:SachaBarber.CQRS.Demo,代码行数:37,代码来源:DomainInstaller.cs

示例10: Install

 public void Install(Castle.Windsor.IWindsorContainer container, Castle.MicroKernel.SubSystems.Configuration.IConfigurationStore store)
 {
     container.AddFacility<LoggingFacility>(f => f.LogUsing(LoggerImplementation.Log4net).WithAppConfig());
     container.AddFacility<TypedFactoryFacility>();
 }
开发者ID:Detroier,项目名称:playground,代码行数:5,代码来源:FacilitiesInstaller.cs

示例11: Install

        public void Install(Castle.Windsor.IWindsorContainer container, Castle.MicroKernel.SubSystems.Configuration.IConfigurationStore store)
        {
            var kernel = container.Kernel;
            kernel.Resolver.AddSubResolver (new CollectionResolver (kernel));
            container.AddFacility<TypedFactoryFacility> ();

            //Configuration
            container.Register (
                Component.For<IConfigurationProvider, ISerialConfigurationProvider, IEmonCmsConfiguration> ().ImplementedBy<AppSettingsBasedConfiguration> ()
            );

            //dbContext
            container.Register (Component.For<IHelloHomeDbContext> ().ImplementedBy<HelloHomeDbContext> ().LifestyleBoundTo<IMessageHandler> ());
            container.Register (Component.For<HelloHomeDbContext> ().LifestyleTransient().Named("TransientDbContext"));

            //Agents
            container.Register (Component.For<INodeGatewayAgent> ()
                                    .ImplementedBy<NodeGatewayAgent> ()
                                    .LifestyleSingleton ());

            container.Register (Component.For<IEmonCmsAgent> ().ImplementedBy<EmonCmsAgent> ());

            //Parsers & encoders
            container.Register (Classes.FromAssemblyContaining<IMessageParser> ().BasedOn<IMessageParser> ().WithServiceBase ());
            container.Register (
                Classes.FromAssemblyContaining<IMessageEncoder> ().BasedOn<IMessageEncoder> ().WithServiceBase (),
                Component.For<PinConfigEncoder> ()
            );

            //EmonCmsUpdater
            container.Register (Component.For<IEMonCmsUpdater> ().ImplementedBy<EMonCmsUpdater> ());

            //HelloHomeGateway
            container.Register (Component.For<HelloHomeGateway> ());

            //MessageHandlers
            container.Register (
                Classes.FromAssemblyContaining<IMessageHandler> ()
                    .BasedOn (typeof (MessageHandler<>))
                    .WithServiceSelf ()
                    .LifestyleTransient (),
                Component.For<MessageHandlerComponentSelector> ()
                    .LifestyleSingleton (),
                Component.For<IMessageHandlerFactory> ()
                    .AsFactory (typeof (MessageHandlerComponentSelector))
            );

            //Queries & Commands
            container.Register (Classes.FromAssemblyContaining<IQuery> ().BasedOn<IQuery> ().WithServiceAllInterfaces ().LifestyleBoundTo<IMessageHandler> ());
            container.Register (Classes.FromAssemblyContaining<ICommand> ().BasedOn<ICommand> ().WithServiceAllInterfaces ().LifestyleBoundTo<IMessageHandler> ());

            //Logic
            container.Register (
                Component.For<ITimeProvider> ().ImplementedBy<TimeProvider> ().LifestyleBoundTo<IMessageHandler> (),
                Component.For<IRfIdGenerationStrategy> ().ImplementedBy<FindHoleRfIdGenerationStrategy> ().LifestyleBoundTo<IMessageHandler> ()
            );

            if(_overrides != null)
                foreach (var r in _overrides)
                    container.Register (r.Named (Guid.NewGuid ().ToString ()).IsDefault ());
        }
开发者ID:vdesmedt,项目名称:HelloHome-NetGateway,代码行数:61,代码来源:DefaultInstaller.cs

示例12: Install

 public void Install(Castle.Windsor.IWindsorContainer container, Castle.MicroKernel.SubSystems.Configuration.IConfigurationStore store)
 {
     container.AddFacility<LoggingFacility>(f => f.UseNLog());
 }
开发者ID:stuartleyland,项目名称:PresentBinder,代码行数:4,代码来源:LoggerInstaller.cs


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