Beispiel #1
0
        private static void PopulateDecoratorInfoFromAttribute(ExportedRegistrationInfo resultInfo, AsDecoratorAttribute attribute,
                                                               Type implementationType)
        {
            Throw.If(resultInfo.FactoryType != FactoryType.Service, Error.UnsupportedMultipleFactoryTypes, implementationType);
            resultInfo.FactoryType = FactoryType.Decorator;
            var decoratedServiceKeyInfo = ServiceKeyInfo.Of(attribute.ContractName ?? attribute.ContractKey);

            resultInfo.Decorator = new DecoratorInfo {
                DecoratedServiceKeyInfo = decoratedServiceKeyInfo
            };
        }
Beispiel #2
0
 /// <summary>Creates exported info out of type and optional key.</summary>
 /// <param name="serviceType">Contract type to store.</param>
 /// <param name="serviceKey">(optional) ContractName string or service key.</param>
 public ExportInfo(Type serviceType, object serviceKey = null)
 {
     ServiceType    = serviceType;
     ServiceKeyInfo = ServiceKeyInfo.Of(serviceKey);
 }