Hi,
We tried to enable IsolationLevel.ReadCommitted in app service and found its working for the getall but not for Repository.GetAsync(id) Working for below code: [UnitOfWork(IsolationLevel.ReadCommitted)] public async Task<PagedResultDto<GetCatetoryForViewDto>> GetAll(GetAllCatetoriesInput input) {
var filteredCatetories = _catetoryRepository.GetAll()
.WhereIf(!string.IsNullOrWhiteSpace(input.Filter), e => false || e.Name.Contains(input.Filter) || e.code.Contains(input.Filter))
.WhereIf(!string.IsNullOrWhiteSpace(input.NameFilter), e => e.Name.Contains(input.NameFilter))
.WhereIf(!string.IsNullOrWhiteSpace(input.codeFilter), e => e.code.Contains(input.codeFilter));
var pagedAndFilteredCatetories = filteredCatetories
.OrderBy(input.Sorting ?? "id asc")
.PageBy(input);
var catetories = from o in pagedAndFilteredCatetories
select new
{
o.Name,
o.code,
Id = o.Id
};
var totalCount = await filteredCatetories.CountAsync();
var dbList = await catetories.ToListAsync();
var results = new List<GetCatetoryForViewDto>();
foreach (var o in dbList)
{
var res = new GetCatetoryForViewDto()
{
Catetory = new CatetoryDto
{
Name = o.Name,
code = o.code,
Id = o.Id,
}
};
results.Add(res);
}
return new PagedResultDto<GetCatetoryForViewDto>(
totalCount,
results
);
}
Not Working for this one [UnitOfWork(IsolationLevel.ReadCommitted)] public async Task<GetCatetoryForViewDto> GetCatetoryForView(int id) { var catetory = await _catetoryRepository.GetAsync(id);
var output = new GetCatetoryForViewDto { Catetory = ObjectMapper.Map<CatetoryDto>(catetory) };
return output;
}
Please suggest way how we can implement the same.
Regards, Harshit
3 Answer(s)
-
0
Hi @kansoftware
- Do you use SQL Server ?
- Could you share the error message ?
Thanks,
-
0
Yes We are using SQL Server. No errors its showing uncommitted records also. So, isolation level mentioned as ReadCommitted is not working
-
0
Hi @kansoftware
Could you send an email to [email protected] about this problem ? We can arrange an online meeting and check this problem on your project.
Thanks,