• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# IConversionManager类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: RelativePathSubDependencyResolver

 /// <summary>
 ///   Constructor
 /// </summary>
 public RelativePathSubDependencyResolver(IKernel kernel)
 {
     m_converter = (IConversionManager)kernel.GetSubSystem(SubSystemConstants.ConversionManagerKey);
       SettingsSubSystem settingsSubSystem = kernel.GetSettingsSubSystem();
       settingsSubSystem.ResolveRelativePaths = true;
       VALUES = new Dictionary<string, object>();
 }
开发者ID:monemihir,项目名称:castle-windsor-extensions,代码行数:10,代码来源:RelativePathSubDependencyResolver.cs


示例2: SetUpComponents

        protected virtual void SetUpComponents(IConfiguration[] configurations, IWindsorContainer container, IConversionManager converter)
        {
            foreach (var component in configurations)
            {
                var implementation = GetType(converter, component.Attributes["type"]);
                var firstService = GetType(converter, component.Attributes["service"]);
                var services = new HashSet<Type>();
                if (firstService != null)
                {
                    services.Add(firstService);
                }
                CollectAdditionalServices(component, converter, services);

                var name = default(string);
                if (implementation != null)
                {
                    AssertImplementsService(component, firstService, implementation);
                    var defaults = CastleComponentAttribute.GetDefaultsFor(implementation);
                    if (defaults.ServicesSpecifiedExplicitly && services.Count == 0)
                    {
                        defaults.Services.ForEach(s => services.Add(s));
                    }
                    name = GetName(defaults, component);
                }

                if (services.Count == 0 && implementation == null)
                {
                    continue;
                }

                container.Register(Component.For(services).ImplementedBy(implementation).Named(name));
            }
        }
开发者ID:janv8000,项目名称:Windsor,代码行数:33,代码来源:DefaultComponentInstaller.cs


示例3: ProcessModel

		/// <summary>
		/// Adds the properties as optional dependencies of this component.
		/// </summary>
		/// <param name="kernel"></param>
		/// <param name="model"></param>
		public virtual void ProcessModel(IKernel kernel, ComponentModel model)
		{
			if (converter == null)
			{
				converter = (IConversionManager) 
					kernel.GetSubSystem( SubSystemConstants.ConversionManagerKey );
			}

			InspectProperties(model);
		}
开发者ID:7digital,项目名称:Castle.Windsor,代码行数:15,代码来源:PropertiesDependenciesModelInspector.cs


示例4: SetUpInstallers

		protected virtual void SetUpInstallers(IConfiguration[] installers, IWindsorContainer container, IConversionManager converter)
		{
			var instances = new Dictionary<Type, IWindsorInstaller>();
			foreach (var installer in installers)
			{
				AddInstaller(installer, instances, converter);
			}

			if (instances.Count != 0)
			{
				container.Install(instances.Values.ToArray());
			}
		}
开发者ID:AGiorgetti,项目名称:Castle.InversionOfControl,代码行数:13,代码来源:DefaultComponentInstaller.cs


示例5: AddInstaller

		private void AddInstaller(IConfiguration installer, Dictionary<Type, IWindsorInstaller> cache,
		                          IConversionManager conversionManager, ICollection<Assembly> assemblies)
		{
			var typeName = installer.Attributes["type"];
			if (string.IsNullOrEmpty(typeName) == false)
			{
				var type = conversionManager.PerformConversion<Type>(typeName);
				AddInstaller(cache, type);
				return;
			}

			assemblyName = installer.Attributes["assembly"];
			if (string.IsNullOrEmpty(assemblyName) == false)
			{
				var assembly = ReflectionUtil.GetAssemblyNamed(assemblyName);
				if (assemblies.Contains(assembly))
				{
					return;
				}
				assemblies.Add(assembly);

				GetAssemblyInstallers(cache, assembly);
				return;
			}

#if !SILVERLIGHT
			var directory = installer.Attributes["directory"];
			var mask = installer.Attributes["fileMask"];
			var token = installer.Attributes["publicKeyToken"];
			Debug.Assert(directory != null, "directory != null");
			var assemblyFilter = new AssemblyFilter(directory, mask);
			if (token != null)
			{
				assemblyFilter.WithKeyToken(token);
			}

			foreach (var assembly in ReflectionUtil.GetAssemblies(assemblyFilter))
			{
				if (assemblies.Contains(assembly))
				{
					continue;
				}
				assemblies.Add(assembly);
				GetAssemblyInstallers(cache, assembly);
			}
#endif
		}
开发者ID:RookieX,项目名称:Windsor,代码行数:47,代码来源:DefaultComponentInstaller.cs


示例6: ProcessModel

            public virtual void ProcessModel(IKernel kernel, ComponentModel model)
            {
                if (converter == null) {
                    converter = (IConversionManager) kernel.GetSubSystem(SubSystemConstants.ConversionManagerKey);
                }

                var targetType = model.Implementation;

                var constructors = targetType.GetConstructors(BindingFlags.Public | BindingFlags.Instance);

                foreach (var constructor in constructors) {
                    // We register each public constructor
                    // and let the ComponentFactory select an
                    // eligible amongst the candidates later
                    model.Constructors.Add(CreateConstructorCandidate(model, constructor));
                }
            }
开发者ID:ruanzx,项目名称:mausch,代码行数:17,代码来源:AttributeServiceOverride.cs


示例7: AddInstaller

		private void AddInstaller(IConfiguration installer, Dictionary<Type, IWindsorInstaller> cache, IConversionManager conversionManager)
		{
			var typeName = installer.Attributes["type"];
			if (string.IsNullOrEmpty(typeName) == false)
			{
				var type = conversionManager.PerformConversion(typeName, typeof(Type)) as Type;
				AddInstaller(cache, type);
				return;
			}

			Debug.Assert(string.IsNullOrEmpty(installer.Attributes["assembly"]) == false);
			var types = Assembly.Load(installer.Attributes["assembly"]).GetExportedTypes();
			foreach (var type in InstallerTypes(types))
			{
				AddInstaller(cache, type);
			}
		}
开发者ID:AGiorgetti,项目名称:Castle.InversionOfControl,代码行数:17,代码来源:DefaultComponentInstaller.cs


示例8: SetUpInstallers

		protected virtual void SetUpInstallers(IConfiguration[] installers, IWindsorContainer container,
		                                       IConversionManager converter)
		{
			var instances = new Dictionary<Type, IWindsorInstaller>();
			ICollection<Assembly> assemblies =
#if SL3
				new List<Assembly>();
#else
				new HashSet<Assembly>();
#endif
			foreach (var installer in installers)
			{
				AddInstaller(installer, instances, converter, assemblies);
			}

			if (instances.Count != 0)
			{
				container.Install(instances.Values.ToArray());
			}
		}
开发者ID:thefringeninja,项目名称:Castle.Windsor,代码行数:20,代码来源:DefaultComponentInstaller.cs


示例9: DeserializeComponents

		private static void DeserializeComponents(XmlNodeList nodes, IConfigurationStore store, IConversionManager converter)
		{
			foreach(XmlNode node in nodes)
			{
				if (node.NodeType != XmlNodeType.Element) continue;

				AssertNodeName(node, ComponentNodeName);
				DeserializeComponent(node, store, converter);
			}
		}
开发者ID:Orvid,项目名称:NAntUniversalTasks,代码行数:10,代码来源:XmlInterpreter.cs


示例10: GetType

		private Type GetType(IConversionManager converter, string typeName)
		{
			if (typeName == null)
			{
				return null;
			}
			return converter.PerformConversion<Type>(typeName);
		}
开发者ID:jmuralimohanbabu,项目名称:Castle.Windsor,代码行数:8,代码来源:DefaultComponentInstaller.cs


示例11: CollectAdditionalServices

		private void CollectAdditionalServices(IConfiguration component, IConversionManager converter, ICollection<Type> services)
		{
			var forwardedTypes = component.Children["forwardedTypes"];
			if (forwardedTypes == null)
			{
				return;
			}

			foreach (var forwardedType in forwardedTypes.Children)
			{
				var forwardedServiceTypeName = forwardedType.Attributes["service"];
				try
				{
					services.Add(converter.PerformConversion<Type>(forwardedServiceTypeName));
				}
				catch (ConverterException e)
				{
					throw new ComponentRegistrationException(
						string.Format("Component {0} defines invalid forwarded type.", component.Attributes["id"]), e);
				}
			}
		}
开发者ID:jmuralimohanbabu,项目名称:Castle.Windsor,代码行数:22,代码来源:DefaultComponentInstaller.cs


示例12: DeserializeComponent

		private static void DeserializeComponent(XmlNode node, IConfigurationStore store, IConversionManager converter)
		{
			var config = XmlConfigurationDeserializer.GetDeserializedNode(node);
			var id = config.Attributes["id"];
			if(string.IsNullOrEmpty(id))
			{
				var type = converter.PerformConversion<Type>(config.Attributes["type"]);
				id = type.FullName;
				config.Attributes["id"] = id;
				config.Attributes.Add("id-automatic", true.ToString());
			}
			AddComponentConfig(id, config, store);
		}
开发者ID:Orvid,项目名称:NAntUniversalTasks,代码行数:13,代码来源:XmlInterpreter.cs


示例13: SynchronizeMetaInfoStore

		/// <summary>
		///   Initializes a new instance of the <see cref = "SynchronizeMetaInfoStore" /> class.
		/// </summary>
		/// <param name = "conversionManager"></param>
		public SynchronizeMetaInfoStore(IConversionManager conversionManager)
		{
			converter = conversionManager;
		}
开发者ID:castleproject,项目名称:Windsor,代码行数:8,代码来源:SynchronizeMetaInfoStore.cs


示例14: SetUpComponents

		protected virtual void SetUpComponents(IConfiguration[] configurations, IWindsorContainer container, IConversionManager converter)
		{
			foreach(IConfiguration component in configurations)
			{
				var id = component.Attributes["id"];
				
				var typeName = component.Attributes["type"];
				var serviceTypeName = component.Attributes["service"];
				
				if (string.IsNullOrEmpty(typeName)) continue;
				
				Type type = ObtainType(typeName,converter);
				Type service = type;

				if (!string.IsNullOrEmpty(serviceTypeName))
				{
					service = ObtainType(serviceTypeName,converter);
				}

				AssertImplementsService(id, service, type);


				Debug.Assert( id != null );
				Debug.Assert( type != null );
				Debug.Assert( service != null );
				container.AddComponent(id, service, type);
				SetUpComponentForwardedTypes(container, component, typeName, id,converter);

			}
		}
开发者ID:AGiorgetti,项目名称:Castle.InversionOfControl,代码行数:30,代码来源:DefaultComponentInstaller.cs


示例15: CreateOnUIThreadInspector

		/// <summary>
		///   Initializes a new instance of the <see cref = "CreateOnUIThreadInspector" /> class.
		/// </summary>
		/// <param name = "config">The config.</param>
		/// <param name = "converter"></param>
		public CreateOnUIThreadInspector(IConfiguration config, IConversionManager converter)
		{
			marshalingControl = new MarshalingControl();
			controlProxyHook = ObtainProxyHook(config, converter);
		}
开发者ID:castleproject,项目名称:Windsor,代码行数:10,代码来源:CreateOnUIThreadInspector.cs


示例16: SetUpFacilities

		protected virtual void SetUpFacilities(IConfiguration[] configurations, IWindsorContainer container, IConversionManager converter)
		{
			foreach (var facility in configurations)
			{
				var type = converter.PerformConversion<Type>(facility.Attributes["type"]);
				var facilityInstance = type.CreateInstance<IFacility>();
				Debug.Assert(facilityInstance != null);

				container.AddFacility(facilityInstance);
			}
		}
开发者ID:thefringeninja,项目名称:Castle.Windsor,代码行数:11,代码来源:DefaultComponentInstaller.cs


示例17: CollectForwardedTypes

		private void CollectForwardedTypes(IKernelInternal kernel, IConfiguration component, string typeName, string id,
		                                   IConversionManager converter, List<Type> services)
		{
			if (kernel == null)
			{
				return;
			}
			var forwardedTypes = component.Children["forwardedTypes"];
			if (forwardedTypes == null)
			{
				return;
			}

			foreach (var forwardedType in forwardedTypes.Children
				.Where(c => c.Name.Trim().Equals("add", StringComparison.InvariantCultureIgnoreCase)))
			{
				var forwardedServiceTypeName = forwardedType.Attributes["service"];
				try
				{
					services.Add(converter.PerformConversion<Type>(forwardedServiceTypeName));
				}
				catch (Exception e)
				{
					throw new Exception(
						string.Format("Component {0}-{1} defines invalid forwarded type.", id ?? string.Empty, typeName), e);
				}
			}
		}
开发者ID:thefringeninja,项目名称:Castle.Windsor,代码行数:28,代码来源:DefaultComponentInstaller.cs


示例18: ComponentProxyInspector

		public ComponentProxyInspector(IConversionManager converter)
		{
			this.converter = converter;
		}
开发者ID:pil0t,项目名称:Castle.Windsor,代码行数:4,代码来源:ComponentProxyInspector.cs


示例19: PropertiesDependenciesModelInspector

		public PropertiesDependenciesModelInspector(IConversionManager converter)
		{
			this.converter = converter;
		}
开发者ID:pmcg,项目名称:Castle.Windsor,代码行数:4,代码来源:PropertiesDependenciesModelInspector.cs


示例20: SetUpComponentForwardedTypes

		private void SetUpComponentForwardedTypes(IWindsorContainer container, IConfiguration component, string typeName, string id, IConversionManager converter)
		{
			var forwardedTypes = component.Children["forwardedTypes"];
			if (forwardedTypes == null) return;

			var forwarded = new List<Type>();
			foreach (var forwardedType in forwardedTypes.Children
				.Where(c => c.Name.Equals("add", StringComparison.InvariantCultureIgnoreCase)))
			{
				var forwardedServiceTypeName = forwardedType.Attributes["service"];
				try
				{
					forwarded.Add(ObtainType(forwardedServiceTypeName,converter));
				}
				catch (Exception e)
				{
					throw new Exception(
						string.Format("Component {0}-{1} defines invalid forwarded type.", id ?? string.Empty, typeName), e);
				}
			}

			foreach (var forwadedType in forwarded)
			{
				container.Kernel.RegisterHandlerForwarding(forwadedType, id);
			}
		}
开发者ID:AGiorgetti,项目名称:Castle.InversionOfControl,代码行数:26,代码来源:DefaultComponentInstaller.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IConverter类代码示例发布时间:2022-05-24
下一篇:
C# IControllerFactory类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap