private Type ValidateService(Type implementation, AddToServicesAttribute attribute) { if (attribute.As != null) { return(attribute.As); } if (attribute.AsImplementedInterface) { return(ValidateAsImplementedInterface(implementation)); } return(implementation); }
/// <summary> /// Initializes a new instance of the <see cref="ApplierContext"/> class. /// </summary> /// <param name="service">The service to apply.</param> /// <param name="attribute">The attribute that decorates the service.</param> public ApplierContext(Type service, AddToServicesAttribute attribute) { Service = service; Lifetime = attribute.Lifetime; As = attribute.As ?? service; }