Exemplo n.º 1
0
        public object Execute(IConnectinContext cc, object value, HandlerValueType type)
        {
            string[] orderby  = DBContext.CurrentOrderBy;
            Region   curegion = DBContext.CurrentRegion;

            DBContext.CurrentRegion  = null;
            DBContext.CurrentOrderBy = null;
            switch (type)
            {
            case HandlerValueType.ValueType:
                return(DBContext.Load(Type, value, cc));

            case HandlerValueType.PROC:
                return(DBContext.ExecProcToObject(Type, cc, value));

            case HandlerValueType.SQL:
                return(((SQL)value).ListFirst(Type, cc));

            case HandlerValueType.EXPRESSION:
                return(((Expression)value).ListFirst(Type, cc, orderby));

            case HandlerValueType.String:
                string str = (string)value;
                if (GetValue.IsValueKey(str))
                {
                    return(DBContext.Load(Type, value, cc));
                }
                else
                {
                    if (GetValue.IsSelectSQL(str))
                    {
                        return(new SQL(str).ListFirst(Type, cc));
                    }
                    else
                    {
                        Expression exp = new Expression(str);
                        return(exp.ListFirst(Type, cc, orderby));
                    }
                }
            }
            return(null);
        }