本文整理汇总了C#中IConversionManager类的典型用法代码示例。如果您正苦于以下问题:C# IConversionManager类的具体用法?C# IConversionManager怎么用?C# IConversionManager使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IConversionManager类属于命名空间,在下文中一共展示了IConversionManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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>();
}
示例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));
}
}
示例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);
}
示例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());
}
}
示例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
}
示例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));
}
}
示例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);
}
}
示例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());
}
}
示例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);
}
}
示例10: GetType
private Type GetType(IConversionManager converter, string typeName)
{
if (typeName == null)
{
return null;
}
return converter.PerformConversion<Type>(typeName);
}
示例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);
}
}
}
示例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);
}
示例13: SynchronizeMetaInfoStore
/// <summary>
/// Initializes a new instance of the <see cref = "SynchronizeMetaInfoStore" /> class.
/// </summary>
/// <param name = "conversionManager"></param>
public SynchronizeMetaInfoStore(IConversionManager conversionManager)
{
converter = conversionManager;
}
示例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);
}
}
示例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);
}