Define Property
Try Get Value
I don't know what I should be doing,I have to use department Repository get the value?
For your issue, it is caused by that GetLoginResultAsync
which calls LoginAsync
did not load your Department navigation property
.
For a workaround, you could requery User
by IRepository<User, long> _userRepository
with loginResult.User.Id
like below:
_userRepository.GetAllIncluding(u => u.Claims,
u => u.CreatorUser,
u => u.DeleterUser,
u => u.Roles,
u => u.Department).FirstOrDefault(u => u.Id ==loginResult.User.Id);