Open
Description
We are trying to do table sharding with following code
` [HttpGet("test/{flag}")]
public string test(string flag)
{
var _repository = _unitOfWork.GetRepository();
Comment _data;
if (flag.Equals("0"))
{
_repository.ChangeTable("Comment_0");
_data = new Comment();
_data.Title = "0";
_data.Content = "0";
}
else
{
_repository.ChangeTable("Comment_1");
_data = new Comment();
_data.Title = "1";
_data.Content = "1";
}
_repository.Insert(_data);
_unitOfWork.SaveChanges();
return $"is:{flag}";
}`
Http client would send some requests with parameter 1 and 0 at the sam time. And the result shows that some rows of 1s go to table "Comment_0" and some rows of 0s go to table "Comment_1". It looks like a concurrency problem to me. Anyone can help?
Thanks!
Metadata
Metadata
Assignees
Labels
No labels