When requiring to create a folder in an action API, would there be any concurrency issue involved? If so, would the proper solution be to use a lock as in the following code
public async Task<IActionResult> UploadFile(User user){
...
var file = HttpContext.Request.Form.File["SomeFile"];
...
var path = Path.Combile(hostingEnvironment.WebRoot, configurationRoot["BaseDirectory"], user.Id);
lock(path){
if(!Directory.Exists(path)){
Directory.CreateDirectory (path);
}
}
...
}
Would it be also logical to use the path
variable as the lock object?