What is the recommended way to return the full username all the to the client (angular) when using FullAuditedEntity ? e.g. get the full user name from the CreatorUserId
3 Answer(s)
-
0
If im not missunderstood, you may want to use
[NotMapped] public string Fullname { get { return FirstName + " " + LastName; } }
in User class. And put the fullname in Output class
-
0
Not quite what I meant.... What I mean is... when I've added an Entity with automatic audit fields (e.g. CreatorUserId, CreationTime, etc.) I can see how to access those fields in the app service and pass them through to the client.
But how do get the corresponding username for that userid? Do I need to access UserManager, and if so - how?
-
0
You can write a linq to join to Users table. If you're using module-zero, then you can inherit from FullAuditedEntity<TPrimaryKey, TUser>, so User properties also added to your entity and you can use navigation properties to access to related User entity. You can use "Include" (for EF) while gettine entities for performance reason.