protected KnownServiceImplementationElement([NotNull] XmlElement xmlElement, [NotNull] IConfigurationFileElement parent, [NotNull] Type implementedServiceType, [NotNull] IImplementedTypeValidator implementedTypeValidator, [NotNull] IInjectedPropertiesValidator injectedPropertiesValidator, [NotNull] ITypeHelper typeHelper) : base(xmlElement, parent, implementedTypeValidator, injectedPropertiesValidator, typeHelper) { ServiceTypeInfo = TypeInfo.CreateNonArrayTypeInfo(implementedServiceType, Configuration.Assemblies.IoCConfigurationAssembly, null); Implementations = new IServiceImplementationElement[] { this }; }
private static TargetImplementationType GetTargetImplementationType([NotNull] IServiceImplementationElement serviceImplementationElement) { if (serviceImplementationElement is ISelfBoundServiceElement) return TargetImplementationType.Self; if (serviceImplementationElement is IServiceToProxyImplementationElement) return TargetImplementationType.ProxiedType; return TargetImplementationType.Type; }
public SelfBoundServiceElement([NotNull] XmlElement xmlElement, [NotNull] IConfigurationFileElement parent, [NotNull] IImplementedTypeValidator implementedTypeValidator, [NotNull] IInjectedPropertiesValidator injectedPropertiesValidator, [NotNull] ITypeHelper typeHelper, [NotNull] IValidateServiceUsageInPlugin validateServiceUsageInPlugin) : base(xmlElement, parent, implementedTypeValidator, injectedPropertiesValidator, typeHelper) { _validateServiceUsageInPlugin = validateServiceUsageInPlugin; Implementations = new IServiceImplementationElement[] { this }; }
/// <summary> /// Initializes a new instance of the <see cref="BindingImplementationConfigurationForFile" /> class. /// </summary> /// <param name="serviceToProxyImplementationElement">The service implementation element.</param> /// <exception cref="System.Exception"> /// </exception> protected BindingImplementationConfigurationForFile([NotNull] IServiceImplementationElement serviceToProxyImplementationElement) : base(GetTargetImplementationType(serviceToProxyImplementationElement), serviceToProxyImplementationElement.ValueTypeInfo.Type) { ResolutionScope = serviceToProxyImplementationElement.ResolutionScope; if (!serviceToProxyImplementationElement.Enabled) throw new Exception($"The value of '{serviceToProxyImplementationElement}.{nameof(IServiceImplementationElement.Enabled)}' cannot be false."); #if DEBUG // Will enable this code in release mode when Autofac implementation for this feature is available. //if (serviceImplementationElement.ConditionalInjectionType != ConditionalInjectionType.None) // SetWhenInjectedIntoData(serviceImplementationElement.ConditionalInjectionType, serviceImplementationElement.WhenInjectedIntoType); #endif }