Пример #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;