答用户10762181
var dep = _departmentRepository.Departments.FirstOrDefault(d => d.DepartmentId == Id);
user.Department = dep;
var result = await userManager.CreateAsync(user, model.Password);
虽然从主表Departments中找到了实例并赋值给了user的Department属性,但是CreateAsync的时候仍然要在主表Departments中添加此Department实例,怎么解决?急!