當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。