0
carelearning created
Hello,
We have a business need to have duplicate Display Names in OrganizationUnits under the same parent. We have association metadata tables to differentiate between them. Is there a way to disable the check on save when using the IRepository<OrganizationUnit>? Currently we get the following error: "There is already an organization unit with name [name]. Two units with same name can not be created in same level." The documentation here does not mention this as a requirement.
Thank you for your time and effort.
Markdown is supported
Copy & paste or drag & drop images (max 30 MB per image)
3 Answer(s)
-
0
You can subclass OrganizationUnitManager to override ValidateOrganizationUnitAsync method, and then inject your subclass in OrganizationAppService.
Markdown is supportedCopy & paste or drag & drop images (max 30 MB per image) -
0
@aaron Thanks! This worked. Our code for those interested:
public class CustomOrganizationUnitManager : OrganizationUnitManager { public CustomOrganizationUnitManager(IRepository<OrganizationUnit, long> organizationUnitRepository) : base(organizationUnitRepository) { } protected override Task ValidateOrganizationUnitAsync(OrganizationUnit organizationUnit) { return Task.CompletedTask; } }usage
public OuManager(IRepository<OrganizationUnit, long> organizationUnitRepository, IRepository<UserOrganizationUnit, long> userOrganizationUnitRepository) { _organizationUnitManager = new CustomOrganizationUnitManager(organizationUnitRepository); _organizationUnitRepository = organizationUnitRepository; _userOrganizationUnitRepository = userOrganizationUnitRepository; }Markdown is supportedCopy & paste or drag & drop images (max 30 MB per image) -
0
That's great :)
Markdown is supportedCopy & paste or drag & drop images (max 30 MB per image)