public static ConcreteMixinTypeAttribute Create(ConcreteMixinTypeIdentifier identifier)
        {
            ArgumentUtility.CheckNotNull("identifier", identifier);

            var identifierSerializer = new AttributeConcreteMixinTypeIdentifierSerializer();

            identifier.Serialize(identifierSerializer);

            return(new ConcreteMixinTypeAttribute(identifierSerializer.Values));
        }
Exemple #2
0
        // Searches the mixin methods corresponding to the methods of the override interface based on a signature comparison and returns a mapping from
        // mixin method to interface method.
        public virtual Dictionary <MethodInfo, MethodInfo> GetOverrideInterfaceMethodsByMixinMethod(
            Type interfaceType,
            ConcreteMixinTypeIdentifier identifier)
        {
            var mixinMethodsWithInterfaceMethods =
                from interfaceMethod in interfaceType.GetMethods()
                let attribute = (OverrideInterfaceMappingAttribute)interfaceMethod.GetCustomAttributes(typeof(OverrideInterfaceMappingAttribute), false)
                                .Single()
                                let resolvedMethod = attribute.ResolveReferencedMethod()
                                                     select new { resolvedMethod, interfaceMethod };

            return(mixinMethodsWithInterfaceMethods.ToDictionary(pair => pair.resolvedMethod, pair => pair.interfaceMethod));
        }
        public ConcreteMixinType(
            ConcreteMixinTypeIdentifier identifier,
            Type generatedType,
            Type generatedOverrideInterface,
            Dictionary <MethodInfo, MethodInfo> overrideInterfaceMethodsByMixinMethod,
            Dictionary <MethodInfo, MethodInfo> methodWrappers)
        {
            ArgumentUtility.CheckNotNull("identifier", identifier);
            ArgumentUtility.CheckNotNull("generatedType", generatedType);
            ArgumentUtility.CheckNotNull("generatedOverrideInterface", generatedOverrideInterface);
            ArgumentUtility.CheckNotNull("overrideInterfaceMethodsByMixinMethod", overrideInterfaceMethodsByMixinMethod);
            ArgumentUtility.CheckNotNull("methodWrappers", methodWrappers);

            _identifier    = identifier;
            _generatedType = generatedType;
            _generatedOverrideInterface            = generatedOverrideInterface;
            _methodWrappers                        = methodWrappers;
            _overrideInterfaceMethodsByMixinMethod = overrideInterfaceMethodsByMixinMethod;
        }
        private static ConcreteMixinTypeIdentifier SubstituteConcreteMixinIdentifier(GeneratedTypesContext context, ConcreteMixinTypeIdentifier identifier)
        {
            var mixinType  = Substitute(context, identifier.MixinType);
            var overriders = identifier.Overriders.Select(m => Substitute(context, m));
            var overridden = identifier.Overridden.Select(m => Substitute(context, m));

            return(new ConcreteMixinTypeIdentifier(mixinType, new HashSet <MethodInfo> (overriders), new HashSet <MethodInfo> (overridden)));
        }
        public ConcreteMixinTypeIdentifier GetIdentifier()
        {
            var deserializer = new AttributeConcreteMixinTypeIdentifierDeserializer(ConcreteMixinTypeIdentifierData);

            return(ConcreteMixinTypeIdentifier.Deserialize(deserializer));
        }