|You only need the
async modifier if you've got an
await in the method. All this method needs to do is return a Task or some kind, which your method isn't doing. A dirty conversion of your code to returning a Task would be:
public Task<CompanyEntity> GetCompany(int id)
return Task.Factory.StartNew<CompanyEntity>(() =>
using (var db = new JayhawkDB())
CompanyEntity results = null;
var query = from x in db.Companies
where x.Id == id
var record = query.FirstOrDefault<Company>();
results = new CompanyEntity
Id = record.Id,
CreatedById = record.CreatedById,
CreatedDT = record.CreatedDt,
DeletedById = record.DeletedById.GetValueOrDefault(),
DeletedDT = record.DeletedDt.GetValueOrDefault(),
CompanyName = record.CompanyName,
Abbreviation = record.Abbreviation,
Notes = record.Notes
awaits this code, not the other way around.
Oh, and that try/catch block is pretty much useless if all you're going to do is catch all Exceptions and just re-throw them.
System.ItDidntWorkException: Something didn't work as expected.
C# - How to debug code
Seriously, go read these articles.