Example #1
0
        protected override IMemberSerialization Create(TypeInfo parameter)
        {
            var members = _members.Get(parameter)
                          .Select(_serializers)
                          .ToArray();
            var result = _builder(members);

            return(result);
        }
Example #2
0
        public IActivator Get(Type parameter)
        {
            var typeInfo    = parameter.GetTypeInfo();
            var constructor = _constructors.Get(typeInfo);
            var members     = constructor != null?_members.Get(constructor) : null;

            var result = members != null
                                ? Activator(constructor, _typeMembers.Get(typeInfo))
                                : _activators.Get(typeInfo);

            return(result);
        }
        public ImmutableArray <IMember> Get(TypeInfo parameter)
        {
            var members = _members.Get(parameter);
            var typed   = _typed.Get(parameter);
            var items   = members?.AddRange(typed) ?? typed;

            var result = items.GroupBy(IdentityFormatter.Default.Get)
                         .Select(x => x.OfType <ParameterizedMember>().FirstOrDefault() ?? x.First())
                         .ToImmutableArray();

            return(result);
        }
Example #4
0
        ImmutableArray <IMember> Implementation(TypeInfo parameter)
        {
            var members = _members.Get(parameter);
            var typed   = _previous.Get(parameter);
            var items   = members?.AddRange(typed) ?? typed;

            var result = items.GroupBy(_group)
                         .Select(x => x.OfType <ParameterizedMember>()
                                 .FirstOrDefault() ?? x.First())
                         .ToImmutableArray();

            return(result);
        }
        protected virtual IEnumerable <T> Members(object input, TypeInfo parameter)
        {
            var members = _members.Get(parameter);
            var length  = members.Length;

            for (var i = 0; i < length; i++)
            {
                var member = members[i];

                foreach (var item in Yield(member, input))
                {
                    yield return(item);
                }
            }
        }
            protected override Tuple <TypeInfo, IMember> Create(TypeInfo parameter)
            {
                var members = _members.Get(parameter);

                for (var i = 0; i < members.Length; i++)
                {
                    var member = members[i];
                    if (_specification(member.Metadata))
                    {
                        var type = _collection.IsSatisfiedBy(member.MemberType)
                                                                   ? member.Metadata.GetCustomAttribute <XmlTextAttribute>()
                                   ?.Type.GetTypeInfo() ?? member.MemberType
                                                                   : member.MemberType;
                        return(Tuple.Create(type, member));
                    }
                }

                return(null);
            }
 public ImmutableArray <IMember> Get(TypeInfo parameter)
 => _typeMembers.Get(parameter)
 .AddRange(Yield(parameter).OrderBy(x => x.Order));