Ejemplo n.º 1
0
        public object Execute(IConnectinContext cc, object value, HandlerValueType type)
        {
            switch (type)
            {
            case HandlerValueType.String:
                return(ExecuseAsSQL(cc, new SQL((string)value)));

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

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

            default:
                throw new PeanutException("object is not a [SQL,StoredProcedure]!");
            }
        }
Ejemplo n.º 2
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);
        }
Ejemplo n.º 3
0
        internal void Execute(HandlerValueType type, object value)
        {
            using (IConnectinContext cc = DBContext.GetConnection(DBContext.CurrentConnectonType))
            {
                IExecuteHandler handler = ExecuteHandler;

                object result = ExecuteHandler.Execute(cc, value, type);
                if (handler is GetValue)
                {
                    if (result != null && result != DBNull.Value)
                    {
                        Value = (T)result;
                    }
                }
                else
                {
                    Value = (T)result;
                }
            }
        }
Ejemplo n.º 4
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.String:
                string str = (string)value;
                if (GetValue.IsSelectSQL(str))
                {
                    return(new SQL(str).List(Type, cc, curegion));
                }
                else
                {
                    Expression exp = new Expression(str);
                    return(exp.List(Type, cc, curegion, orderby));
                }

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

                break;

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

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

            default:
                throw new PeanutException("object is not a [SQL,StoredProcedure,Expression]!");
            }
        }