示例#1
0
        public async Task <IEnumerable <TEntity> > ExecSPToListAsync(StoredProcedure sp)
        {
            Task <IEnumerable <TEntity> > Result;

            try
            {
                Result = Task.Run(() =>
                {
                    return(Context.Set <TEntity>().FromSql <TEntity>(sp.SP, sp.args).ToList().AsEnumerable());
                });
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                throw e;
            }
            finally
            {
                DbUtil.DisposeAll();
            }
            return(await Result);
        }