- ABP Framework version: v7.4.4
- UI Type: Blazor WASM
- Database System: EF Core (SQL Server,)
- Tiered (for MVC) or Auth Server Separated (for Angular): /no
- Exception message and full stack trace:
- Steps to reproduce the issue:
Dear All,
1- Is there a way to Customize the Organization unit, such as to change the coding Mechanism? 2- Can we have several organization Units in the same application for example for Location and Category?
Thanks, Mina.
11 Answer(s)
-
0
Hi,
Is there a way to Customize the Organization unit, such as to change the coding Mechanism
You can replace the OrganizationUnitManager to override the GetNextChildCodeAsync method
Can we have several organization Units in the same application for example for Location and Category?
1 : You can use organization Units as Location and Category, you need to differentiate between them in business
Organization Units Location A Location A-a Location A-b Location B Location A-a Location A-b Category A Category A-a2: You can create new organization tree entities for Location and Category.
Here is a library that can help you simplify the development process: https://github.com/maliming/Owl.GeneralTree
Markdown supported.Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post) -
0
For Question Number 1: 1- For Example, if we need to change the CodeUnitLength, as it is a static class, we can't Override, so what is the right way to do it?
namespace Volo.Abp.Identity; public static class OrganizationUnitConsts { /// <summary> /// Length of a code unit between dots. /// </summary> ** public const int CodeUnitLength = 5;** }2- For Question 2 , will check the option and revert back to you.
Thanks, Mina.
Markdown supported.Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post) -
0
For Example, if we need to change the CodeUnitLength, as it is a static class, we can't Override, so what is the right way to do it?
It's not a big problem.
You can change the length of the OrganizationUnit entity:
protected override void OnModelCreating(ModelBuilder builder) { ..... // Update the code length builder.Entity<OrganizationUnit>(b => { b.Property(x => x.Code).HasMaxLength(10); }); }dotnet ef migratons add change_code_lengthdotnet ef database updateMarkdown supported.Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post) -
0
Ok, I think I explained it above: You can replace the OrganizationUnitManager to override the GetNextChildCodeAsync method
For example:
[ExposeServices(typeof(OrganizationUnitManager))] public class MyOrganizationUnitManager : OrganizationUnitManager { public override async Task<string> GetNextChildCodeAsync(Guid? parentId) { var code = await base.GetNextChildCodeAsync(parentId); return code.SubString(2); } }Markdown supported.Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post) -
0
For the below provided Solution: Organization Units
Location A Location A-a Location A-b
Location B Location A-a Location A-b
Category A Category A-a
if we have one Entity such as Book that should has Location and Category and both will be implemented by Organization Unit as above , how we could add the property in the Book Entity
Markdown supported.Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post) -
0
Hi,
The organizational units provided by ABP are used to organize users and roles.
I suggest that you create Category and Location entities instead of using organizational units.
Markdown supported.Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post) -
0
Do you mean to use this "Here is a library that can help you simplify the development process: https://github.com/maliming/Owl.GeneralTree"
is there a guide on how to integrate it into our ABP application?
Markdown supported.Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post) -
0
Hi,
Here is a simple project: https://github.com/maliming/Owl.GeneralTree/tree/dev/app
Markdown supported.Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post) -
0
Hi,
No such guide, and the app is not a module. This is a sample project using this library.
You can refer to it.
And the
Owl.GeneralTreeis a library to help you develop tree entities. It provides some practical methods, such as adding deletions and moving tree nodes.Markdown supported.Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)