Ejemplo n.º 1
0
 public ConnectionBuilder <object> GetConnectionBuilderArgument(
     ModelMember modelMember,
     ConnectionBuilder <object> connectionBuilder)
 {
     return(modelMember.IsOptional ?
            connectionBuilder.Argument <ModelConventionInputType <StringEqualFilter> >(modelMember.Name, modelMember.Description) :
            connectionBuilder.Argument <NonNullGraphType <ModelConventionInputType <StringEqualFilter> > >(modelMember.Name, modelMember.Description));
 }
Ejemplo n.º 2
0
 private ConnectionBuilder <ModelConventionType <TSource>, object> GetConnectionBuilderArgument <TSource>(ModelMember modelMember, ConnectionBuilder <ModelConventionType <TSource>, object> connectionBuilder)
 {
     return(modelMember.IsOptional ?
            connectionBuilder.Argument <ModelConventionInputType <GuidFilter> >(modelMember.Name, modelMember.Description) :
            connectionBuilder.Argument <NonNullGraphType <ModelConventionInputType <GuidFilter> > >(modelMember.Name, modelMember.Description));
 }
Ejemplo n.º 3
0
        public static void PopulateWithArguments <TSource>(this QueryParameterBuilder <TSource> queryParameterBuilder,
                                                           ConnectionBuilder <ModelConventionType <TSource>, object> connectionBuilder)
        {
            queryParameterBuilder.ForEach(modelMember =>
            {
                if (modelMember.SourceType == typeof(SearchModel) && modelMember.IsString)
                {
                    connectionBuilder = modelMember.IsOptional ?
                                        connectionBuilder.Argument <ModelConventionInputType <SearchFilter> >(modelMember.Name, modelMember.Description) :
                                        connectionBuilder.Argument <NonNullGraphType <ModelConventionInputType <SearchFilter> > >(modelMember.Name, modelMember.Description);

                    return;
                }

                if (modelMember.IsString)
                {
                    connectionBuilder = modelMember.IsOptional ?
                                        connectionBuilder.Argument <ModelConventionInputType <StringFilter> >(modelMember.Name, modelMember.Description) :
                                        connectionBuilder.Argument <NonNullGraphType <ModelConventionInputType <StringFilter> > >(modelMember.Name, modelMember.Description);

                    return;
                }

                if (modelMember.IsInt)
                {
                    connectionBuilder = modelMember.IsOptional ?
                                        connectionBuilder.Argument <ModelConventionInputType <IntFilter> >(modelMember.Name, modelMember.Description) :
                                        connectionBuilder.Argument <NonNullGraphType <ModelConventionInputType <IntFilter> > >(modelMember.Name, modelMember.Description);

                    return;
                }

                if (modelMember.IsDate)
                {
                    connectionBuilder = modelMember.IsOptional ?
                                        connectionBuilder.Argument <ModelConventionInputType <DateFilter> >(modelMember.Name, modelMember.Description) :
                                        connectionBuilder.Argument <NonNullGraphType <ModelConventionInputType <DateFilter> > >(modelMember.Name, modelMember.Description);

                    return;
                }

                if (modelMember.IsBool)
                {
                    connectionBuilder = modelMember.IsOptional ?
                                        connectionBuilder.Argument <ModelConventionInputType <BoolFilter> >(modelMember.Name, modelMember.Description) :
                                        connectionBuilder.Argument <NonNullGraphType <ModelConventionInputType <BoolFilter> > >(modelMember.Name, modelMember.Description);

                    return;
                }

                if (modelMember.IsGuid)
                {
                    connectionBuilder = modelMember.IsOptional ?
                                        connectionBuilder.Argument <ModelConventionInputType <GuidFilter> >(modelMember.Name, modelMember.Description) :
                                        connectionBuilder.Argument <NonNullGraphType <ModelConventionInputType <GuidFilter> > >(modelMember.Name, modelMember.Description);

                    return;
                }

                throw new NotImplementedException($"QueryArgument type is not yet implemented for {modelMember.Name}");
            });
        }