Exemplo n.º 1
0
        public Command <TResult> GetSelectCommand <TResult>(Expression <Func <TEntity, TResult> > exp)
        {
            var _result = new ExpressionAnalyzer(exp, _table).GetAnalysisResult();

            _creator.CreateSelect(_result);
            _creator.CreateFrom(_result.Table, _tableInfo);
            return(new Command <TResult>()
            {
                ConStr = _tableInfo.ConStr,
                CommandText = CommandTextHelper.GetSelectCommandText(_creator),
                Params = _params
            });
        }
Exemplo n.º 2
0
        public Command <int> GetCountCommand(Expression <Func <TEntity, bool> > exp)
        {
            var retData = new ExpressionAnalyzer(exp).GetAnalysisResult();

            _creator.CreateWhere(retData);
            _creator.GetCount();
            _creator.CreateFrom(retData.Table, _tableInfo);
            return(new Command <int>()
            {
                CommandText = CommandTextHelper.GetCountCommandText(_creator),
                ConStr = _tableInfo.ConStr,
                Params = retData.ParamList
            });
        }