Reputation: 1375
Using the ABP Suite, I am trying to add a navigation property to the IdentityUser class. In my case, I want to add a State entity as part of adding address properties to the IdentityUser. I have added several extended properties to the IdentityUser at this point, but I'm kind of scratching my head on this one. I could go in and add the State by hand, but that would not generate the UI controls. Does anyone have a method for doing this?
Upvotes: 0
Views: 778
Reputation: 852
You can add property by using Object Extensions and set them as navigation properties by adding other entity Id as foreign key.
Associate a department to a user from docs:
ObjectExtensionManager.Instance.Modules()
.ConfigureIdentity(identity =>
{
identity.ConfigureUser(user =>
{
user.AddOrUpdateProperty<Guid>(
"DepartmentId",
property =>
{
property.UI.Lookup.Url = "/api/departments";
property.UI.Lookup.DisplayPropertyName = "name";
}
);
});
});
And the "/api/departments" endpoint:
[Route("api/departments")]
public class DepartmentController : AbpController
{
[HttpGet]
public async Task<ListResultDto<DepartmentDto>> GetAsync()
{
...
}
}
Upvotes: 1