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


C# Core.ComponentModel类代码示例

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


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

示例1: GetMismatch

		private IEnumerable<LifestyleDependency> GetMismatch(LifestyleDependency parent, ComponentModel component,
		                                                     Dictionary<ComponentModel, IHandler> model2Handler)
		{
			if (parent.Handler.ComponentModel == component)
			{
				yield break;
			}

			var handler = model2Handler[component];
			var item = new LifestyleDependency(handler, parent);
			if (item.Mismatched())
			{
				yield return item;
			}
			else
			{
				foreach (ComponentModel dependent in handler.ComponentModel.Dependents)
				{
					foreach (var mismatch in GetMismatch(item, dependent, model2Handler))
					{
						yield return mismatch;
					}
				}
			}
		}
开发者ID:oleksii-mdr,项目名称:Castle.Windsor,代码行数:25,代码来源:PotentialLifestyleMismatches.cs

示例2: SetOnBehalfAware

 protected static void SetOnBehalfAware(IOnBehalfAware onBehalfAware, ComponentModel target)
 {
     if (onBehalfAware != null)
     {
         onBehalfAware.SetInterceptedComponentModel(target);
     }
 }
开发者ID:janv8000,项目名称:Windsor,代码行数:7,代码来源:AbstractProxyFactory.cs

示例3: Resolve

 public object Resolve(CreationContext context,
     ISubDependencyResolver parentResolver,
     ComponentModel model,
     DependencyModel dependency)
 {
     return _kernel.ResolveAll(dependency.TargetType.GetElementType(), null);
 }
开发者ID:agross,项目名称:fizzbuzz,代码行数:7,代码来源:ArraySubDependencyResolver.cs

示例4: ProcessModel

		public void ProcessModel(IKernel kernel, ComponentModel model)
		{
			if (model.Configuration == null)
			{
				return;
			}

			var remoteserverAttValue = model.Configuration.Attributes["remoteserver"];
			var remoteclientAttValue = model.Configuration.Attributes["remoteclient"];

			var server = RemotingStrategy.None;
			var client = RemotingStrategy.None;

			if (remoteserverAttValue == null && remoteclientAttValue == null)
			{
				return;
			}

			if (remoteserverAttValue != null)
			{
				server = converter.PerformConversion<RemotingStrategy>(remoteserverAttValue);
			}

			if (remoteclientAttValue != null)
			{
				client = converter.PerformConversion<RemotingStrategy>(remoteclientAttValue);
			}

			DoSemanticCheck(server, model, client);

			ConfigureServerComponent(server, model.Implementation, model);

			ConfigureClientComponent(client, model.Services.Single(), model);
		}
开发者ID:castleproject,项目名称:Windsor,代码行数:34,代码来源:RemotingInspector.cs

示例5: UpdateActivator

		private void UpdateActivator(ComponentModel model)
		{
			if (model.CustomComponentActivator == null)
			{
				model.CustomComponentActivator = typeof(WcfBehaviorActivator);
			}
		}
开发者ID:AdamChang,项目名称:Castle.Facilities.Wcf-READONLY,代码行数:7,代码来源:WcfBehaviorInspector.cs

示例6: ProcessModel

		public void ProcessModel(IKernel kernel, ComponentModel model)
		{
			if (model.Configuration == null)
			{
				return;
			}

			var mixins = model.Configuration.Children["mixins"];
			if (mixins == null)
			{
				return;
			}

			var mixinReferences = new List<ComponentReference<object>>();
			foreach (var mixin in mixins.Children)
			{
				var value = mixin.Value;

				var mixinComponent = ReferenceExpressionUtil.ExtractComponentKey(value);
				if (mixinComponent == null)
				{
					throw new Exception(
						String.Format("The value for the mixin must be a reference to a component (Currently {0})", value));
				}

				mixinReferences.Add(new ComponentReference<object>("mixin-" + mixinComponent, mixinComponent));
			}
			if (mixinReferences.Count == 0)
			{
				return;
			}
			var options = ProxyUtil.ObtainProxyOptions(model, true);
			mixinReferences.ForEach(options.AddMixinReference);
		}
开发者ID:Orvid,项目名称:NAntUniversalTasks,代码行数:34,代码来源:MixinInspector.cs

示例7: AbstractComponentActivator

		/// <summary>
		///   Constructs an AbstractComponentActivator
		/// </summary>
		protected AbstractComponentActivator(ComponentModel model, IKernel kernel, ComponentInstanceDelegate onCreation, ComponentInstanceDelegate onDestruction)
		{
			this.model = model;
			this.kernel = kernel;
			this.onCreation = onCreation;
			this.onDestruction = onDestruction;
		}
开发者ID:martinernst,项目名称:Castle.Windsor,代码行数:10,代码来源:AbstractComponentActivator.cs

示例8: CanResolve

		/// <summary>
		///   Returns true if the resolver is able to satisfy the specified dependency.
		/// </summary>
		/// <param name = "context">Creation context, which is a resolver itself</param>
		/// <param name = "contextHandlerResolver">Parent resolver</param>
		/// <param name = "model">Model of the component that is requesting the dependency</param>
		/// <param name = "dependency">The dependency model</param>
		/// <returns>
		///   <c>true</c>
		///   if the dependency can be satisfied</returns>
		public bool CanResolve(CreationContext context, ISubDependencyResolver contextHandlerResolver, ComponentModel model, DependencyModel dependency)
		{
			// 1 - check for the dependency on CreationContext, if present
			if (CanResolveFromContext(context, contextHandlerResolver, model, dependency))
			{
				return true;
			}

			// 2 - check with the model's handler, if not the same as the parent resolver
			if (CanResolveFromHandler(context, contextHandlerResolver, model, dependency))
			{
				return true;
			}

			// 3 - check within parent resolver, if present
			if (CanResolveFromContextHandlerResolver(context, contextHandlerResolver, model, dependency))
			{
				return true;
			}

			// 4 - check within subresolvers
			if (CanResolveFromSubResolvers(context, contextHandlerResolver, model, dependency))
			{
				return true;
			}

			// 5 - normal flow, checking against the kernel
			return CanResolveFromKernel(context, model, dependency);
		}
开发者ID:jmuralimohanbabu,项目名称:Castle.Windsor,代码行数:39,代码来源:DefaultDependencyResolver.cs

示例9: Kernel_ComponentCreated

 private void Kernel_ComponentCreated(ComponentModel model, object instance)
 {
     if (instance is IListener)
     {
         _eventPublisher.AddListener((IListener) instance);
     }
 }
开发者ID:henryjwr,项目名称:Windows-Forms-MVP,代码行数:7,代码来源:EventPublisherFacility.cs

示例10: CreateTransactionConfig

		private TransactionConfig CreateTransactionConfig(ComponentModel model)
		{
			TransactionConfig config = new TransactionConfig();
			GatherTransactionAttributes(config, model.Implementation);
			GatherTransactionConfiguration(config, model);
			return config;
		}
开发者ID:ralescano,项目名称:castle,代码行数:7,代码来源:TransactionFacility.cs

示例11: SelectInterceptors

		public InterceptorReference[] SelectInterceptors(ComponentModel model, InterceptorReference[] interceptors)
		{
			return new[]
			{
				new InterceptorReference(interceptorType),
			};
		}
开发者ID:castleproject,项目名称:Windsor,代码行数:7,代码来源:ByTypeInterceptorSelector.cs

示例12: Kernel_ComponentModelCreated

        private void Kernel_ComponentModelCreated(ComponentModel model)
        {
            IEnumerable <Type> services = model.Services;
            bool isView = services.Any(x => x.GetInterface("IView") != null);

            //		   if (!services.Select(service => typeof (IView).IsAssignableFrom(service)).Any(isView => isView))
            //		   {
            //		      return;
            //		   }
            //
            //		   if (model.CustomComponentActivator == null)
            //		   {
            //		      model.CustomComponentActivator = typeof (WpfWindowActivator);
            //		   }

            //         bool isView = model
            //
            if ( !isView )
            {
                return;
            }

            if ( model.CustomComponentActivator == null )
            {
                model.CustomComponentActivator = typeof( WpfWindowActivator );
            }
        }
开发者ID:tschroedter,项目名称:Selkie.WPF,代码行数:27,代码来源:ViewActivatorFacility.cs

示例13: Resolve

			public object Resolve(CreationContext context, ISubDependencyResolver contextHandlerResolver, ComponentModel model,
			                      DependencyModel dependency)
			{
				return contextHandlerResolver.Resolve(context, contextHandlerResolver, model,
				                                      new DependencyModel(DependencyType.Service, typeof(IBookStore).FullName,
				                                                          typeof(IBookStore), false));
			}
开发者ID:ralescano,项目名称:castle,代码行数:7,代码来源:SubResolversShouldNotBeTrustedToBeCorrect.cs

示例14: NoResolvableConstructorFoundException

		public NoResolvableConstructorFoundException(Type type, ComponentModel componentModel)
			: base(
				string.Format("Could not find resolvable constructor for {0}. Make sure all required dependencies are provided.",
				              type.FullName), componentModel)
		{
			this.type = type;
		}
开发者ID:castleproject,项目名称:Windsor,代码行数:7,代码来源:NoResolvableConstructorFoundException.cs

示例15: ProcessModel

		/// <summary>
		/// Queries the kernel's ConfigurationStore for a configuration
		/// associated with the component name.
		/// </summary>
		/// <param name="kernel"></param>
		/// <param name="model"></param>
		public virtual void ProcessModel(IKernel kernel, ComponentModel model)
		{
			IConfiguration config = kernel.ConfigurationStore.GetComponentConfiguration(model.Name) ??
									kernel.ConfigurationStore.GetBootstrapComponentConfiguration(model.Name);

			model.Configuration = config;
		}
开发者ID:ralescano,项目名称:castle,代码行数:13,代码来源:ConfigurationModelInspector.cs


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