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


C# Castle类代码示例

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


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

示例1: Install

 public void Install(Castle.Windsor.IWindsorContainer container, Castle.MicroKernel.SubSystems.Configuration.IConfigurationStore store)
 {
     container.Register
         (
                 new NhibernateAssemblySourceForRegistration(typeof(User).Assembly)
         );
 }
开发者ID:mwojcik,项目名称:SportReservation,代码行数:7,代码来源:WindsorInstaller.cs

示例2: Kernel_ComponentRegistered

 private static void Kernel_ComponentRegistered(string key, Castle.MicroKernel.IHandler handler)
 {
     if (typeof(IApplicationService).IsAssignableFrom(handler.ComponentModel.Implementation))
     {
         handler.ComponentModel.Interceptors.Add(new InterceptorReference(typeof(ValidationInterceptor)));
     }
 }
开发者ID:dazyzsy,项目名称:ZBP,代码行数:7,代码来源:ValidationInterceptor.cs

示例3: Kernel_ComponentModelCreated

		static void Kernel_ComponentModelCreated(Castle.Core.ComponentModel model)
		{
			if (model.Services.First().IsGenericType && model.Services.First().GetGenericTypeDefinition().Equals(typeof(IHandleCommand<>)))
			{
				model.CustomComponentActivator = typeof(CommandHandlerComponentActivator);
			}
		}
开发者ID:gadjio,项目名称:Smi-Playground,代码行数:7,代码来源:CommandHandlerDecorationFacility.cs

示例4: Install

        public void Install(Castle.Windsor.IWindsorContainer container, Castle.MicroKernel.SubSystems.Configuration.IConfigurationStore store)
        {
            container.Register(Component.For<LastTasksByUserPresenter>()
                                        .Named("InnerLastTasksByUserPresenter")
                                        .LifeStyle.Transient);

            container.Register(Component.For<ILastTasksByUserPresenter>()
                                        .ImplementedBy<LastTasksByUserPresenterWithScope>()
                                        .ServiceOverrides(ServiceOverride.ForKey<ILastTasksByUserPresenter>().Eq("InnerLastTasksByUserPresenter"))
                                        .LifeStyle.Transient);

            container.Register(AllTypes.FromThisAssembly()
                .Where(Component.IsInSameNamespaceAs<IBlogsFromDatabasePresenter>())
                .WithService.DefaultInterface()
                .Configure(c => c.LifeStyle.Transient));

            //container.Register(AllTypes.FromThisAssembly()
            //    .Where(Component.IsInSameNamespaceAs<ILastTasksByUserPresenter>())
            //    .WithService.DefaultInterface()
            //    .Configure(c => c.LifeStyle.Transient));

            container.Register(AllTypes.FromThisAssembly()
                .Where(Component.IsInSameNamespaceAs<ILastTasksByUserQuery>())
                .WithService.DefaultInterface()
                .Configure(c => c.LifeStyle.Transient));

            container.Register(AllTypes.FromThisAssembly()
                .Where(Component.IsInSameNamespaceAs<IAddPostCommand>())
                .WithService.DefaultInterface()
                .Configure(c => c.LifeStyle.Transient));
        }
开发者ID:Detroier,项目名称:playground,代码行数:31,代码来源:PresentersInstaller.cs

示例5: Install

 public void Install(Castle.Windsor.IWindsorContainer container, Castle.MicroKernel.SubSystems.Configuration.IConfigurationStore store)
 {
     xrc.XrcWindsor.InstallExtension(container, System.Reflection.Assembly.Load("xrc.MVC4"));
     xrc.XrcWindsor.InstallExtension(container, System.Reflection.Assembly.Load("xrc.FileSystemPages"));
     xrc.XrcWindsor.InstallExtension(container, System.Reflection.Assembly.Load("xrc.Markdown"));
     xrc.XrcWindsor.InstallExtension(container, System.Reflection.Assembly.Load("DemoWebSite.Lib"));
 }
开发者ID:davideicardi,项目名称:xrc,代码行数:7,代码来源:CustomXrcInstaller.cs

示例6: Install

 public void Install(IWindsorContainer container, Castle.MicroKernel.SubSystems.Configuration.IConfigurationStore store)
 {
     container.Register(Component.For<Shell>());
     container.Register(Component.For<MainModule>());
     container.Register(Component.For<TeacherModule>());
     container.Register(Component.For<StackPanelRegionAdapter>());
 }
开发者ID:kwapisiewicz,项目名称:Edu,代码行数:7,代码来源:UIInstaller.cs

示例7: Instantiate

		protected override object Instantiate(Castle.MicroKernel.CreationContext context)
		{
			Type systemType = (Type) 
				Model.ExtendedProperties[PrevalenceFacility.SystemTypePropertyKey];
			String dir = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, (String) 
				Model.ExtendedProperties[PrevalenceFacility.StorageDirPropertyKey]);
			bool autoVersionMigration = (bool) 
				Model.ExtendedProperties[PrevalenceFacility.AutoMigrationPropertyKey];
			bool resetStorage = (bool) 
				Model.ExtendedProperties[PrevalenceFacility.ResetStoragePropertyKey];
			float snapshotPeriod = (float)Model.ExtendedProperties[PrevalenceFacility.SnapshotPeriodPropertyKey];
			
			if (resetStorage)
			{
				DeleteStorageDir(dir);
			}

			PrevalenceEngine engine = PrevalenceActivator.CreateEngine( 
				systemType, 
				dir, 
				autoVersionMigration );

			if (snapshotPeriod > 0)
			{
				CreateSnapshotTaker(engine, snapshotPeriod);
			}

			return engine;
		}
开发者ID:ralescano,项目名称:castle,代码行数:29,代码来源:PrevalenceEngineComponentActivator.cs

示例8: Resolve

 protected override void Resolve(Castle.Windsor.IWindsorContainer windsor)
 {
     //提前注册桩
     windsor.RegisterComponent(typeof(ProcessServiceMock));
     windsor.RegisterComponent(typeof(SchedulerServiceMock));
     base.Resolve(windsor);
 }
开发者ID:jatinbhole,项目名称:NTFE-BPM,代码行数:7,代码来源:SchedulerFaultResumptionTest.cs

示例9: Install

        public void Install(Castle.Windsor.IWindsorContainer container, Castle.MicroKernel.SubSystems.Configuration.IConfigurationStore store)
        {
            container.Register(
                Component.For<CommandExecutor>(),
                Component.For<AppCommands>(),
                Component.For<TextChangedTrigger>(),

                Component.For<TasksModule>(),

                Component.For<ProgramService>(),

                Component.For<AppValueProvider>(),
                Component.For<VariablesStorage>(),

                Component.For<Context>(),

                Component.For<XmlDataSource<ItemsDb>>(),
                Component.For<DataStorage<ItemsDb>>(),

                Component.For<ProgramCommand>(),
                Component.For<StartProcessCommand>(),
                Component.For<TasksCommand>(),

                Component.For<MainViewModel>());
        }
开发者ID:AliAboSaada,项目名称:windows-home-panel,代码行数:25,代码来源:ContainerInstaller.cs

示例10: Install

 public void Install(Castle.Windsor.IWindsorContainer container,
 Castle.MicroKernel.SubSystems.Configuration.IConfigurationStore store)
 {
     container.Register(Classes.FromThisAssembly()
      .BasedOn<ApiController>()
      .LifestylePerWebRequest());
 }
开发者ID:jay81979,项目名称:XmlEdit,代码行数:7,代码来源:WindsorDependencyResolver.cs

示例11: Install

		public void Install(IWindsorContainer container, Castle.MicroKernel.SubSystems.Configuration.IConfigurationStore store)
		{
			// use installer.
			// container.Install(new PersonInstaller());

			container.Register(Component.For<IPerson>().ImplementedBy<Person>());
		}
开发者ID:LoveJenny,项目名称:Examples,代码行数:7,代码来源:PersonInstaller.cs

示例12: Start

    // Use this for initialization
    void Start()
    {
        direction = Random.Range(0,2);
        droppedBomb = true;
        enemy = this.GetComponent<Rigidbody2D>();
        enemyPosition = enemy.transform.position;
        animations = this.GetComponent<Animator>();
        healthdecrease = GameObject.FindGameObjectWithTag("Castle").GetComponent<Castle>();
        rightToLeft = new Vector3(1,1,1);
        leftToRight = new Vector3(-1,1,1);
        doNotMove = false;

        this.GetComponent<AudioSource>().clip = myclip;

        if (direction == 0)
        {
            tempVar = new Vector3 (9f, 0f, 0f);
            enemy.transform.position = tempVar;
        }
        else
        {
            tempVar = new Vector3 (9f, 0f, 0f);
            enemy.transform.position = -tempVar;
        }
    }
开发者ID:BhavikHMehta,项目名称:Myo-Defense,代码行数:26,代码来源:EnemyFlying.cs

示例13: Install

 public void Install(Castle.Windsor.IWindsorContainer container, Castle.MicroKernel.SubSystems.Configuration.IConfigurationStore store)
 {
     container.Register(
       Classes.FromThisAssembly()
       .BasedOn(typeof(System.Web.Mvc.ControllerBase))
       .LifestyleTransient());
 }
开发者ID:CezaryRynkowski,项目名称:NHibernateMVC,代码行数:7,代码来源:ControllerInstaller.cs

示例14: Install

 public void Install(IWindsorContainer container, Castle.MicroKernel.IConfigurationStore store)
 {
     container
         .Register(Component.For<IPostService>()
                   	.ImplementedBy<PostService>())
         .Register(Component.For<IMailService>()
                   	.ImplementedBy<MailService>())
         .Register(Component.For<IFriendlyUrlGenerator>()
                   	.ImplementedBy<FriendlyUrlGenerator>())
         .Register(AllTypes.Of(typeof (IValidatorBase<>))
                   	.FromAssemblyNamed("BlogSharp.Model")
                   	.WithService.FromInterface(typeof (IValidatorBase<>))
                   	.Configure(x => x.LifeStyle.Transient))
         .AddFacility<ControllerRegisterFacility>()
         .Register(AllTypes.Of<IController>()
                   	.FromAssemblyNamed("BlogSharp.Web").Configure(x => x.LifeStyle.Transient))
         .Register(Component.For<IExtendedControllerFactory>()
                   	.ImplementedBy<WindsorControllerFactory>())
         .Register(AllTypes.Of<IStartupInstaller>()
                   	.FromAssemblyNamed("BlogSharp.Core.Impl")
                   	.WithService.FirstInterface())
         .Register(AllTypes.Of<IHttpModule>()
                   	.FromAssemblyNamed("BlogSharp.Core.Impl"))
         .Register(Component.For<BlogContextProvider>()
                   	.ImplementedBy<WebBlogContextProvider>());
 }
开发者ID:DogaOztuzun,项目名称:BlogSharp,代码行数:26,代码来源:DefaultComponentInstallers.cs

示例15: Init

 public void Init(IKernel kernel, Castle.Core.Configuration.IConfiguration facilityConfig)
 {
     InterceptorFactory.Create = new InterceptorFactory.CreateInterceptor(delegate()
     {
         return new AuditInterceptor(kernel);
     });
 }
开发者ID:julienblin,项目名称:Colibri,代码行数:7,代码来源:AuditFacility.cs


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