public IWindsorContainer AddComponent <T>() { var t = typeof(T); AddComponent(ComponentName.DefaultNameFor(t), t); return(this); }
public IWindsorContainer AddComponentLifeStyle <I, T>(LifestyleType lifestyle) where T : class { var t = typeof(T); AddComponentLifeStyle(ComponentName.DefaultNameFor(t), typeof(I), t, lifestyle); return(this); }
public IWindsorContainer AddComponentWithProperties <T>(IDictionary extendedProperties) { var t = typeof(T); AddComponentWithProperties(ComponentName.DefaultNameFor(t), t, extendedProperties); return(this); }
public IWindsorContainer AddComponent <I, T>() where T : class { var t = typeof(T); AddComponent(ComponentName.DefaultNameFor(t), typeof(I), t); return(this); }
/// <summary> /// Builds a service override using other component registered with given <paramref name = "componentImplementation" /> and no explicit name, as value for dependency with given <see /// cref = "Key" />. /// </summary> /// <returns></returns> public ServiceOverride Is(Type componentImplementation) { if (componentImplementation == null) { throw new ArgumentNullException(nameof(componentImplementation)); } return(GetServiceOverrideKey().Eq(ComponentName.DefaultNameFor(componentImplementation))); }
protected string GetName(Type service) { var defaultName = ComponentName.DefaultNameFor(service); if (string.IsNullOrEmpty(defaultName)) { return("auto-factory: " + Guid.NewGuid()); } return("auto-factory: " + defaultName); }
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 = ComponentName.DefaultNameFor(type); config.Attributes["id"] = id; config.Attributes.Add("id-automatic", bool.TrueString); } AddComponentConfig(id, config, store); }
public void Picks_component_implemented_by_that_type_with_default_name_if_multiple() { Container.Register(Component.For <CommonServiceUser>() .DependsOn(Dependency.OnComponent <ICommon, CommonImpl2>()), Component.For <ICommon>().ImplementedBy <CommonImpl1>(), Component.For <ICommon>().ImplementedBy <CommonImpl2>().Named("something"), Component.For <ICommon>().ImplementedBy <CommonImpl2>()); var item = Container.Resolve <CommonServiceUser>(); Assert.IsInstanceOf <CommonImpl2>(item.CommonService); var default2 = Container.Resolve <ICommon>(ComponentName.DefaultNameFor(typeof(CommonImpl2))); Assert.AreSame(default2, item.CommonService); }
private void Apply(ComponentModel model, Object dependencyKey, Object dependencyValue, ServiceOverride @override) { if (dependencyValue is String) { ApplySimpleReference(model, dependencyKey, (String)dependencyValue); } else if (dependencyValue is IEnumerable <String> ) { ApplyReferenceList(model, dependencyKey, (IEnumerable <String>)dependencyValue, @override); } else if (dependencyValue is Type) { ApplySimpleReference(model, dependencyKey, ComponentName.DefaultNameFor((Type)dependencyValue)); } else if (dependencyValue is IEnumerable <Type> ) { ApplyReferenceList(model, dependencyKey, ((IEnumerable <Type>)dependencyValue).Select(ComponentName.DefaultNameFor), @override); } }
public void AddComponent <T>(Type serviceType) { var classType = typeof(T); AddComponent(ComponentName.DefaultNameFor(classType), serviceType, classType); }
public void AddComponent <T>() { var classType = typeof(T); AddComponent(ComponentName.DefaultNameFor(classType), classType); }
public void AddComponent <T>(LifestyleType lifestyle) { var classType = typeof(T); AddComponent(ComponentName.DefaultNameFor(classType), classType, lifestyle); }
public EventSubscribers To <TSubscriber>() { return(To(ComponentName.DefaultNameFor(typeof(TSubscriber)))); }
/// <summary> /// Creates a new instance of <see cref = "ComponentReference{T}" /> referencing default component implemented by <paramref /// name = "componentType" /> /// </summary> /// <param name = "componentType"></param> public ComponentReference(Type componentType) { referencedComponentName = ComponentName.DefaultNameFor(componentType); referencedComponentType = componentType; }
private string GetServiceName(Type serviceType, string serviceName) { return(ComponentName.DefaultNameFor(serviceType) + (string.IsNullOrEmpty(serviceName) ? null : '.' + serviceName)); }
public void AddComponent <T>(Type serviceType, LifestyleType lifestyle, bool overwriteLifestyle) { var classType = typeof(T); AddComponent(ComponentName.DefaultNameFor(classType), serviceType, classType, lifestyle, overwriteLifestyle); }
public EventSubscribers To <TSubscriber>(string methodHandler) { return(To(ComponentName.DefaultNameFor(typeof(TSubscriber)), methodHandler)); }
public void AddComponentInstance <T>(Type serviceType, object instance) { var classType = typeof(T); AddComponentInstance(ComponentName.DefaultNameFor(classType), serviceType, classType, instance); }
public EventSubscribers To <TSubscriber>(Expression <Action <TSubscriber> > methodHandler) { return(To(ComponentName.DefaultNameFor(typeof(TSubscriber)), methodHandler)); }