Example #1
0
        public static object GetObjeto(this FilterTipo tipo, Type elementType, string valor)
        {
            switch (tipo)
            {
            case FilterTipo.Expressao:
            case FilterTipo.Clausula:
                return(valor.GetObjetoExpressao(elementType));

            case FilterTipo.Filtro:
            case FilterTipo.Model:
                return(valor.GetObjectFromJson(elementType));
            }

            return(null);
        }
Example #2
0
        public static string GetValor(this FilterTipo tipo, object valor)
        {
            switch (tipo)
            {
            case FilterTipo.Expressao:
            case FilterTipo.Clausula:
                return(valor as string);

            case FilterTipo.Filtro:
            case FilterTipo.Model:
                return(valor?.GetJson());
            }

            return(null);
        }
Example #3
0
 public FilterObjeto(FilterTipo tipo, Type elementType, object valor)
 {
     Tipo        = tipo;
     ElementType = elementType;
     Valor       = tipo.GetValor(valor);
 }