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实例,怎么解决?急!
... 展开详请