Wednesday, June 26, 2019

Get records from a stored procedure with the database-first approach to Entity Framework.

Sort of a variant on this, we have...

public async Task<IEnumerable<IBusinessUnit>> GetBusinessUnits()
{
   var entity = await this.DbSetBusinessUnit
         .FromSql("UI.GetBusinessUnit").ToListAsync();
   return _mapper.Map<List<BusinessUnit>, List<IBusinessUnit>>(entity);
}

No comments:

Post a Comment