A
ardmore
Guest
Hello,
In my asp.net core controller I have the code
[HttpGet]
[Route("GetProject")]
public ActionResult GetProject()
{
var list = (from x in _dbContext.Project
join y in _dbContext.Department
on x.Id equals y.Id
select new MyClass
{
ProjectId = x.Id,
Name = x.Name,
Type = y.Type,
Status = y.Status
}).ToList();
if(list.Count == 0)
{
return NotFound("NotFound");
}
return Json(list);
}
It works fine, but it is synchronized. I heard that in asp.net and entity framework the best is to use asynchronous way.
Now I want to convert it with asynchronous way, the difficult thing is there is a join operation.
Continue reading...
In my asp.net core controller I have the code
[HttpGet]
[Route("GetProject")]
public ActionResult GetProject()
{
var list = (from x in _dbContext.Project
join y in _dbContext.Department
on x.Id equals y.Id
select new MyClass
{
ProjectId = x.Id,
Name = x.Name,
Type = y.Type,
Status = y.Status
}).ToList();
if(list.Count == 0)
{
return NotFound("NotFound");
}
return Json(list);
}
It works fine, but it is synchronized. I heard that in asp.net and entity framework the best is to use asynchronous way.
Now I want to convert it with asynchronous way, the difficult thing is there is a join operation.
Continue reading...