Esempio n. 1
0
 public ResolveFieldById(
     IResolveBuilder <Field> parent,
     IEnumerable <Guid> identifiers
     )
     : base(parent, identifiers, f => f.Id)
 {
 }
 public ResolveListViewByUrl(
     IResolveBuilder <View> parent,
     IEnumerable <String> identifiers
     )
     : base(parent, identifiers, StringComparer.OrdinalIgnoreCase)
 {
 }
Esempio n. 3
0
 public ResolveListByUrl(
     IResolveBuilder <List> parent,
     IEnumerable <String> urls
     )
     : base(parent, urls, StringComparer.OrdinalIgnoreCase)
 {
 }
Esempio n. 4
0
 protected IdentifierResolveBuilder(
     IResolveBuilder <TResult> parent,
     IEnumerable <TIdentifier> identifiers
     )
     : this(parent, identifiers, null)
 {
 }
Esempio n. 5
0
 public ResolveTermSetById(
     IResolveBuilder <TermSet> parent,
     IEnumerable <Guid> identifiers
     )
     : base(parent, identifiers, ts => ts.Id)
 {
 }
Esempio n. 6
0
 public ResolveFieldByInternalName(
     IResolveBuilder <Field> parent,
     IEnumerable <String> identifiers
     )
     : base(parent, identifiers, f => f.InternalName)
 {
 }
Esempio n. 7
0
        protected IdentifierResolveBuilder(
            IResolveBuilder <TResult> parent,
            IEnumerable <TIdentifier> identifiers,
            IEqualityComparer <TIdentifier> identifierComparer
            )
        {
            if (parent == null)
            {
                throw Logger.Fatal.ArgumentNull(nameof(parent));
            }

            if (identifiers == null)
            {
                throw Logger.Fatal.ArgumentNull(nameof(identifiers));
            }

            if (identifierComparer == null)
            {
                identifierComparer = EqualityComparer <TIdentifier> .Default;
            }

            Parent = parent;

            Identifiers = ImmutableHashSet.CreateRange(
                identifierComparer, identifiers
                );
        }
Esempio n. 8
0
 public ResolveListById(
     IResolveBuilder <List> parent,
     IEnumerable <Guid> identifiers
     )
     : base(parent, identifiers, l => l.Id)
 {
 }
        private static Object CreateResult(
            PropertyAccessor property,
            IResolveBuilder resolveBuilder,
            IEnumerable resultSource,
            IEnumerable <ResolveFailure> failureSource
            )
        {
            if (resultSource == null)
            {
                Logger.Warning(
                    "Property {PropertyName} resolver {$Resolver} resolved into null value.",
                    property.Name,
                    resolveBuilder
                    );

                return(null);
            }

            var result = ResolveResultFactory.CreateResult(
                property.PropertyTypeInfo,
                resultSource,
                resolveBuilder,
                failureSource
                );

            Logger.Debug(
                "Property {PropertyName} resolver {$Resolver} result adapted into {$Value}, assigning.",
                property.Name,
                resolveBuilder,
                result
                );

            return(result);
        }
 public ResolveContentTypeById(
     IResolveBuilder <ContentType> parent,
     IEnumerable <HarshContentTypeId> ids
     )
     : base(parent, ids)
 {
 }
 protected ClientObjectIdentifierResolveBuilder(
     IResolveBuilder <TResult> parent,
     IEnumerable <TIdentifier> identifiers,
     Expression <Func <TResult, TIdentifier> > identifierExpression
     )
     : this(parent, identifiers, null, identifierExpression)
 {
 }
Esempio n. 12
0
        public ResolveBuilderAdapter(IResolveBuilder builder)
        {
            if (builder == null)
            {
                throw Logger.Fatal.ArgumentNull(nameof(builder));
            }

            _inner = builder;
        }
Esempio n. 13
0
        protected async Task <IEnumerable <T> > ResolveAsync <T>(IResolveBuilder <T, ClientObjectResolveContext> builder)
            where T : ClientObject
        {
            var results = ManualResolver.Resolve(builder);

            await ClientContext.ExecuteQueryAsync();

            return(results);
        }
        public static IResolveBuilder <TResult> As <TResult>(this IResolveBuilder builder)
        {
            if (builder == null)
            {
                throw Logger.Fatal.ArgumentNull(nameof(builder));
            }

            return(new ResolveBuilderAdapter <TResult>(builder));
        }
Esempio n. 15
0
        protected NestedResolveBuilder(IResolveBuilder <TParent> parent)
        {
            if (parent == null)
            {
                throw Logger.Fatal.ArgumentNull(nameof(parent));
            }

            Parent = parent;
        }
Esempio n. 16
0
        public ResolveFailure(IResolveBuilder resolveBuilder, Object identifier)
        {
            if (resolveBuilder == null)
            {
                throw Logger.Fatal.ArgumentNull(nameof(resolveBuilder));
            }

            ResolveBuilder = resolveBuilder;
            Identifier = identifier;
        }
Esempio n. 17
0
        public ResolveFailure(IResolveBuilder resolveBuilder, Object identifier)
        {
            if (resolveBuilder == null)
            {
                throw Logger.Fatal.ArgumentNull(nameof(resolveBuilder));
            }

            ResolveBuilder = resolveBuilder;
            Identifier     = identifier;
        }
        protected ClientObjectNestedResolveBuilder(
            IResolveBuilder <TParent> parent,
            Expression <Func <TParent, IEnumerable <TResult> > > childrenExpression
            )
            : base(parent)
        {
            if (childrenExpression == null)
            {
                throw Logger.Fatal.ArgumentNull(nameof(childrenExpression));
            }

            ChildrenExpression = childrenExpression.ConvertToObject();
            ChildrenSelector   = childrenExpression.Compile();
        }
Esempio n. 19
0
        public void AddFailure(IResolveBuilder resolveBuilder, Object identifier)
        {
            if (resolveBuilder == null)
            {
                throw Logger.Fatal.ArgumentNull(nameof(resolveBuilder));
            }


            if (_failures == null)
            {
                _failures = new List <ResolveFailure>();
            }

            _failures.Add(new ResolveFailure(resolveBuilder, identifier));
        }
        protected ClientObjectIdentifierResolveBuilder(
            IResolveBuilder <TResult> parent,
            IEnumerable <TIdentifier> identifiers,
            IEqualityComparer <TIdentifier> identifierComparer,
            Expression <Func <TResult, TIdentifier> > identifierExpression
            )
            :
            base(parent, identifiers, identifierComparer)
        {
            if (identifierExpression == null)
            {
                throw Logger.Fatal.ArgumentNull(nameof(identifierExpression));
            }

            IdentifierExpression = identifierExpression.ConvertToObject();
            IdentifierSelector   = identifierExpression.Compile();
        }
Esempio n. 21
0
        public static Object CreateResult(
            TypeInfo propertyTypeInfo,
            IEnumerable enumerable,
            IResolveBuilder builder,
            IEnumerable <ResolveFailure> failures
            )
        {
            if (propertyTypeInfo == null)
            {
                throw Logger.Fatal.ArgumentNull(nameof(propertyTypeInfo));
            }

            if (enumerable == null)
            {
                throw Logger.Fatal.ArgumentNull(nameof(enumerable));
            }

            if (builder == null)
            {
                throw Logger.Fatal.ArgumentNull(nameof(builder));
            }

            if (failures == null)
            {
                throw Logger.Fatal.ArgumentNull(nameof(failures));
            }

            var property = ResolvedPropertyTypeInfo.Parse(propertyTypeInfo);

            var enumerableTypes =
                GetEnumerableTypes(enumerable.GetType())
                .ToArray();

            if (!enumerableTypes.Contains(property.ResolvedType))
            {
                enumerable = CreateConverter(enumerable, property.ResolvedType);
            }

            var result = CreateResult(property);

            result.ResolveBuilder  = builder;
            result.ResolveFailures = failures;
            result.Results         = enumerable;
            return(result);
        }
        public static Object CreateResult(
            TypeInfo propertyTypeInfo,
            IEnumerable enumerable,
            IResolveBuilder builder,
            IEnumerable<ResolveFailure> failures
        )
        {
            if (propertyTypeInfo == null)
            {
                throw Logger.Fatal.ArgumentNull(nameof(propertyTypeInfo));
            }

            if (enumerable == null)
            {
                throw Logger.Fatal.ArgumentNull(nameof(enumerable));
            }

            if (builder == null)
            {
                throw Logger.Fatal.ArgumentNull(nameof(builder));
            }

            if (failures == null)
            {
                throw Logger.Fatal.ArgumentNull(nameof(failures));
            }

            var property = ResolvedPropertyTypeInfo.Parse(propertyTypeInfo);

            var enumerableTypes =
                GetEnumerableTypes(enumerable.GetType())
                .ToArray();

            if (!enumerableTypes.Contains(property.ResolvedType))
            {
                enumerable = CreateConverter(enumerable, property.ResolvedType);
            }

            var result = CreateResult(property);
            result.ResolveBuilder = builder;
            result.ResolveFailures = failures;
            result.Results = enumerable;
            return result;
        }
        private static IEnumerable CreateResultSource(String propertyName, IResolveBuilder resolveBuilder, IResolveContext resolveContext)
        {
            Logger.Debug(
                "Property {PropertyName} resolver {$Resolver} initializing.",
                propertyName,
                resolveBuilder
                );

            var resultSource = resolveBuilder.ToEnumerable(
                resolveContext
                ,
                resolveBuilder.Initialize(resolveContext));

            Logger.Debug(
                "Property {PropertyName} resolver {$Resolver} resolved into {$Value}.",
                propertyName,
                resolveBuilder,
                resultSource
                );

            return(resultSource);
        }
 private void InitializeInner(IResolveContext context)
 {
     _inner = _factory();
     _inner.InitializeContext(context);
 }
Esempio n. 25
0
 public ResolveContentTypeFieldLink(IResolveBuilder <ContentType, ClientObjectResolveContext> parent)
     : base(parent, ct => ct.FieldLinks)
 {
 }
Esempio n. 26
0
 public ResolveTermStoreTermSet(IResolveBuilder <TermStore, ClientObjectResolveContext> parent)
     : base(parent)
 {
 }
Esempio n. 27
0
 public ResolveListRootFolder(IResolveBuilder <List, ClientObjectResolveContext> parent)
     : base(parent, l => l.RootFolder)
 {
 }
Esempio n. 28
0
 public ResolveFailure(IResolveBuilder resolveBuilder)
     : this(resolveBuilder, null)
 {
 }
Esempio n. 29
0
 public ResolveFailure(IResolveBuilder resolveBuilder)
     : this(resolveBuilder, null)
 {
 }
 public ResolveListContentType(IResolveBuilder <List> parent)
     : base(parent, l => l.ContentTypes)
 {
 }
        private static Object CreateResult(
            PropertyAccessor property,
            IResolveBuilder resolveBuilder,
            IEnumerable resultSource,
            IEnumerable<ResolveFailure> failureSource
        )
        {
            if (resultSource == null)
            {
                Logger.Warning(
                    "Property {PropertyName} resolver {$Resolver} resolved into null value.",
                    property.Name,
                    resolveBuilder
                );

                return null;
            }

            var result = ResolveResultFactory.CreateResult(
                property.PropertyTypeInfo,
                resultSource,
                resolveBuilder,
                failureSource
            );

            Logger.Debug(
                "Property {PropertyName} resolver {$Resolver} result adapted into {$Value}, assigning.",
                property.Name,
                resolveBuilder,
                result
            );

            return result;
        }
        private static IEnumerable CreateResultSource(String propertyName, IResolveBuilder resolveBuilder, IResolveContext resolveContext)
        {
            Logger.Debug(
                "Property {PropertyName} resolver {$Resolver} initializing.",
                propertyName,
                resolveBuilder
            );

            var resultSource = resolveBuilder.ToEnumerable(
                resolveContext
,
                resolveBuilder.Initialize(resolveContext));

            Logger.Debug(
                "Property {PropertyName} resolver {$Resolver} resolved into {$Value}.",
                propertyName,
                resolveBuilder,
                resultSource
            );

            return resultSource;
        }
Esempio n. 33
0
 public ResolveListField(IResolveBuilder <List, ClientObjectResolveContext> parent)
     : base(parent, l => l.Fields)
 {
 }
Esempio n. 34
0
 public ResolveListView(IResolveBuilder <List, ClientObjectResolveContext> parent)
     : base(parent, l => l.Views)
 {
 }
Esempio n. 35
0
 public static ResolveTermStoreTermSet TermSet(this IResolveBuilder <TermStore, ClientObjectResolveContext> termStore)
 => new ResolveTermStoreTermSet(termStore);