示例#1
0
        private static string GetOperator(QueryFieldType type)
        {
            switch (type)
            {
            case QueryFieldType.Equal:
                return("=");

            case QueryFieldType.GreaterThan:
                return(">");

            case QueryFieldType.GreaterThanOrEqual:
                return(">=");

            case QueryFieldType.LessThan:
                return("<");

            case QueryFieldType.LessThanOrEqual:
                return("<=");

            case QueryFieldType.Like:
                return("LIKE");

            case QueryFieldType.NotLike:
                return("NOT LIKE");

            case QueryFieldType.NotEqual:
                return("!=");

            default:
                throw new InvalidOperationException(String.Format(CultureInfo.CurrentCulture,
                                                                  "Query Field Type '{0}' is not implemented.", type));
            }
        }
示例#2
0
        public static IEnumerable <QueryField> GetFields(GraphQlMutation query, QueryFieldType type)
        {
            var properties = query.GetType().GetProperties();

            return
                (from prop in properties
                 let attr = prop.GetCustomAttribute <QueryFieldAttribute>()
                            where attr != null && attr.Type == type
                            select new QueryField(prop, attr, query, attr.Type));
        }
示例#3
0
        private static DbType ConvertDbType(QueryFieldType qfType)
        {
            switch (qfType)
            {
            case QueryFieldType.Boolean:
                return(DbType.Boolean);

            case QueryFieldType.DateTime:
                return(DbType.DateTime);

            case QueryFieldType.Numeric:
                return(DbType.Decimal);

            case QueryFieldType.String:
                return(DbType.String);

            default:
                return(DbType.String);
            }
        }
示例#4
0
 public FieldQuery(string name, string value, QueryFieldType valueType)
 {
     Name      = name;
     Value     = value;
     ValueType = valueType;
 }
示例#5
0
 public QueryFieldAttribute(QueryFieldType type, [CallerMemberName] string name = null, bool expandContents = true) : base(name.ToCamelCase(), expandContents)
     => Type = type;
示例#6
0
 public QueryField(PropertyInfo property, QueryFieldAttribute attribute, object parent, QueryFieldType type)
     : base(property, attribute, parent) => Type = type;