// ReSharper disable once TooManyDependencies
 /// <summary>
 /// Initializes a new instance of the <see cref="T:ExtendedXmlSerializer.ExtensionModel.Content.Members.MemberPropertiesExtension"/> class.
 /// </summary>
 /// <param name="names">The names.</param>
 /// <param name="order">The order.</param>
 /// <param name="defaultNames">The default names.</param>
 /// <param name="defaultMemberOrder">The default member order.</param>
 public MemberPropertiesExtension(IDictionary <MemberInfo, string> names, IDictionary <MemberInfo, int> order,
                                  INames defaultNames, IParameterizedSource <MemberInfo, int> defaultMemberOrder)
 {
     _defaultNames       = defaultNames;
     _defaultMemberOrder = defaultMemberOrder;
     Order = order;
     Names = names;
 }
 public Source(IAllowedValueSpecification allowed,
               IGeneric <ISpecification <object>, ISpecification <object> > generic,
               IParameterizedSource <TypeInfo, TypeInfo> type)
 {
     _allowed = allowed;
     _generic = generic;
     _type    = type;
 }
        public static ImmutableArray <TItem>?GetAny <T, TItem>(this IParameterizedSource <T, ImmutableArray <TItem> > @this,
                                                               T parameter)
        {
            var items  = @this.Get(parameter);
            var result = items.Any() ? items : (ImmutableArray <TItem>?)null;

            return(result);
        }
 protected GenericAdapterBase(Type definition, IParameterizedSource <TypeInfo, T> source)
     : base(
         new SelectCoercer <TypeInfo, Type>(TypeCoercer.Default.ToDelegate())
         .To(new GenericTypeAlteration(definition))
         .To(TypeMetadataCoercer.Default)
         .To(source)
         )
 {
 }
 public ListSerializer(ISerializer serializer, ISerializers serializers, IMemberSerializer @default,
                       IMemberSerializer item, IIdentity identity, ILists lists, TypeInfo type)
 {
     _serializer  = serializer;
     _serializers = serializers;
     _default     = @default;
     _item        = item;
     _identity    = identity;
     _lists       = lists;
     _type        = type;
 }
Example #6
0
        IAllowedMemberValues Register(IServiceProvider arg)
        {
            IParameterizedSource <MemberInfo, IAllowedValueSpecification>
            seed         = new Seeding(Specifications, Instances, _allowed).Get(),
                fallback = _allowed == AllowAssignedValues
                                                   ? Source.Default
                                                   : new FixedInstanceSource <MemberInfo, IAllowedValueSpecification>(_allowed);
            var source = this.Appending(fallback)
                         .Aggregate(seed, (current, item) => current.Or(item));
            var result = new AllowedMemberValues(source);

            return(result);
        }
        IAllowedMemberValues Register(IServiceProvider arg)
        {
            IParameterizedSource <MemberInfo, IAllowedValueSpecification>
            seed = new MappedAllowedMemberValues(Specifications
                                                 .ToDictionary(x => x.Key, x => (ISpecification <object>)x.Value)
                                                 .Concat(Instances)
                                                 .GroupBy(x => x.Key)
                                                 .ToDictionary(x => x.Key, Create)),
                fallback = _allowed == AllowAssignedValues
                                                   ? Source.Default
                                                   : new FixedInstanceSource <MemberInfo, IAllowedValueSpecification>(_allowed);
            var source = this.Appending(fallback)
                         .Aggregate(seed, (current, item) => current.Or(item));
            var result = new AllowedMemberValues(source);

            return(result);
        }
Example #8
0
 /// <exclude />
 public ConditionalSource(ISpecification <TParameter> specification, ISpecification <TResult> result,
                          IParameterizedSource <TParameter, TResult> source,
                          IParameterizedSource <TParameter, TResult> fallback)
     : this(specification.IsSatisfiedBy, result.IsSatisfiedBy, source.Get, fallback.Get)
 {
 }
Example #9
0
 public ListContentSerializer(IMemberSerializer item, string name, ILists lists)
 {
     _item  = item;
     _name  = name;
     _lists = lists;
 }
Example #10
0
 public DecoratedSource(IParameterizedSource <TParameter, TResult> source) => _source = source;
 public CoercedResult(IParameterizedSource <TParameter, TResult> source, IParameterizedSource <TResult, TTo> coercer)
 {
     _coercer = coercer;
     _source  = source;
 }
Example #12
0
 /// <inheritdoc />
 public SpecificationSource(ISpecification <TParameter> specification,
                            IParameterizedSource <TParameter, TResult> source)
 {
     _specification = specification;
     _source        = source;
 }
Example #13
0
 public static T Get <T>(this IParameterizedSource <ImmutableArray <TypeInfo>, T> @this, params TypeInfo[] parameters)
 => @this.Get(parameters.ToImmutableArray());
 public LinkedDecoratedSource(IParameterizedSource <TParameter, TResult> source,
                              IParameterizedSource <TParameter, TResult> next)
 {
     _source = source;
     _next   = next;
 }
Example #15
0
 public AlteredSource(IAlteration <TResult> alteration, IParameterizedSource <TParameter, TResult> source)
 {
     _alteration = alteration;
     _source     = source;
 }
		SingletonDefaultValueProvider( IParameterizedSource<Type, object> provider, Type hostType = null )
		{
			this.hostType = hostType;
			this.provider = provider;
		}
Example #17
0
 public ImplicitTypeIdentities(ITypeIdentities identities, IParameterizedSource <string, TypeInfo> types)
 {
     _identities = identities;
     _types      = types;
 }
 public AllowedMemberValues(IParameterizedSource <MemberInfo, IAllowedValueSpecification> source) : base(source)
 {
 }
Example #19
0
 /// <inheritdoc />
 public SpecificationSource(IParameterizedSource <TParameter, TResult> source) :
     this(source.IfAssigned(), source)
 {
 }
 Evaluation(ISource <Exception> exception, IParameterizedSource <TypeInfo, object> implementation)
     : base(implementation) => _exception = exception;
Example #21
0
 public MemberNames(IParameterizedSource <MemberInfo, string> source) : base(source.Get)
 {
 }
Example #22
0
 public Store(ITableSource <string, object> store, IParameterizedSource <string, IMember> members)
     : this(store, members, TypeDefaults.Default)
 {
 }
 public XmlInnerContentActivation(IActivation activation, IParameterizedSource <TypeInfo, IXmlContentsActivator> activator)
 {
     _activation = activation;
     _activator  = activator;
 }
Example #24
0
 public CoercedParameter(IParameterizedSource <TFrom, TTo> coercer, IParameterizedSource <TTo, TResult> source)
 {
     _coercer = coercer;
     _source  = source;
 }
 public AssociationAwareReferenceMaps(IParameterizedSource <IFormatReader, IReferenceMap> maps)
     : base(maps.In(AssociatedReaders.Default))
 {
 }
Example #26
0
 public static ISpecification <TParameter> IfAssigned <TParameter, TResult>(
     this IParameterizedSource <TParameter, TResult> @this)
 => @this.ToDelegate()
 .IfAssigned();
 ReferenceCache <TParameter, TResult>(this IParameterizedSource <TParameter, TResult> @this)
     where TParameter : class where TResult : class
 =>
 new DelegatedSource <TParameter, TResult>(
     ReferenceCachingAlteration <TParameter, TResult>
     .Default.Get(@this.ToDelegate()));
Example #28
0
 public FixedSource(IParameterizedSource <TParameter, TResult> source, TParameter parameter) : this(source.Get, parameter)
 {
 }
Example #29
0
 /// <exclude />
 public ConditionalSource(ISpecification <TParameter> specification,
                          IParameterizedSource <TParameter, TResult> source,
                          IParameterizedSource <TParameter, TResult> fallback)
     : this(specification, AlwaysSpecification <TResult> .Default, source, fallback)
 {
 }
Example #30
0
 public Generic(Type definition, IParameterizedSource <TypeInfo, Func <T> > source) : base(definition, source)
 {
 }
Example #31
0
 public Names(IParameterizedSource <TypeInfo, string> source) : base(source.Get)
 {
 }
		protected AttributeProviderBase()
		{
			defined = new DelegatedSpecification<Type>( Contains ).ToCachedSpecification();
			factory = new Cache<Type, IEnumerable<Attribute>>( GetAttributes );
		}