0
zhongfang created
- ABP Framework version: v5.1.4
- UI type: Blazor
- DB provider: EF Core
- Tiered (MVC) or Identity Server Separated (Angular): no
https://community.abp.io/posts/abp-suite-how-to-add-the-user-entity-as-a-navigation-property-of-another-entity-furp75ex
I follow above topic. But I got an error. (await GetDbContextAsync()).Users There is no property named Users in EasyCommentDbContext.
protected virtual async Task<IQueryable<CommentWithNavigationProperties>> GetQueryForNavigationPropertiesAsync()
{
return from comment in (await GetDbSetAsync())
join appUser in (await GetDbContextAsync()).Users on comment.AppUserId equals appUser.Id into users
from appUser in users.DefaultIfEmpty()
select new CommentWithNavigationProperties
{
Comment = comment,
AppUser = appUser
};
}
3 Answer(s)
-
0
I created 2 files as below
Yee.EasyComment.Application.Contracts.Users
public class AppUserDto : IdentityUserDto { }
Yee.EasyComment.Domains.Users
public class AppUser : IdentityUser { }
-
0
Waiting for reply……
-
0
It is not a good practice to inherit from IdentityUser. I would suggest using Object Extensions.
Or create a different entity isolating your user-related business:
public class AppUser: Entity<Guid> { public Guid IdentityUserId {get; set;} public IdentityUser User {get; set; }
You can event use the same IdentityUserId for AppUser if you care.