Exemple #1
0
        public TResult Execute <TResult>(System.Linq.Expressions.Expression expression)
        {
            SAPTable <TResult> table = (SAPTable <TResult>) this.CreateQuery <TResult>(expression);

            if (table._count && (typeof(TResult) == typeof(int)))
            {
                return((TResult)table.GetResultsCount());
            }
            if (typeof(TResult) == typeof(TEntity))
            {
                return((TResult)table.GetResultsSingle());
            }
            if (typeof(TResult) != typeof(IEnumerable <TEntity>))
            {
                throw new NotSupportedException("The given expression cannot be evaluated and executed");
            }
            return((TResult)table.GetResults());
        }