I have been following the guide on how to customize the app modules with the intention of extending module entities with new properties and exposing these with a modified service/controller .
I have extended OrganizationUnit from a module with the following properties: and then mapped these new properties to the same database table as OrganizationUnit by updating DbContext.OnModelCreating and EfCoreEntityExtensionMappings and and Dto Extensions and created a database-migration
And here is user interface for inserting new organization unit and its work fine
Summary To summarize, I wish to achieve the following:
How do I add new method from applications services and controllers in a way that enables me to get list of UnitCategory as dropdown list? I have implemented the following based on the solution #438 :
public interface IAppOrganizationUnitAppService : IOrganizationUnitAppService
{
Task<PagedResultDto<LookupDto>> GetUnitCategoryLookupAsync(LookupRequestDto input);
}
[RemoteService(IsEnabled = false)] // If you use dynamic controller feature you can disable remote service. Prevent creating duplicate controller for the application service.
[Dependency(ReplaceServices = true)]
[ExposeServices( typeof(OrganizationUnitAppService),typeof(IAppOrganizationUnitAppService))]
public class AppOrganizationUnitAppService : OrganizationUnitAppService, IAppOrganizationUnitAppService
{
private readonly IMODRepository<OrganizationUnitCategory, Guid> _unitCategoryRepository;
public AppOrganizationUnitAppService(
OrganizationUnitManager organizationUnitManager,
IdentityUserManager userManager,
IOrganizationUnitRepository organizationUnitRepository,
IIdentityUserRepository identityUserRepository,
IIdentityRoleRepository identityRoleRepository,
IMODRepository<OrganizationUnitCategory, Guid> unitCategoryRepository)
:base(organizationUnitManager,userManager, organizationUnitRepository, identityUserRepository, identityRoleRepository)
{
_unitCategoryRepository = unitCategoryRepository;
}
public async Task<PagedResultDto<LookupDto>> GetUnitCategoryLookupAsync(LookupRequestDto input)
{
var query = _unitCategoryRepository.AsQueryable()
.WhereIf(!string.IsNullOrWhiteSpace(input.Filter), x => x.ArabicName != null && x.ArabicName.Contains(input.Filter));
var lookupData = await query.PageBy(input.SkipCount, input.MaxResultCount).ToDynamicListAsync<OrganizationUnitCategory>();
var totalCount = query.Count();
return new PagedResultDto<LookupDto>
{
TotalCount = totalCount,
Items = ObjectMapper.Map<List<OrganizationUnitCategory>, List<LookupDto>>(lookupData)
};
}
}
[Dependency(ReplaceServices = true)]
[ExposeServices(typeof(OrganizationUnitController), typeof(IAppOrganizationUnitAppService))]
[RemoteService(true, Name = "AbpIdentity")]
[Route("api/identity/organization-units", Order = 0)]
[ControllerName("OrganizationUnit")]
[Area("identity")]
public class AppOrganizationUnitController : OrganizationUnitController, IAppOrganizationUnitAppService
{
public AppOrganizationUnitController(IOrganizationUnitAppService organizationUnitAppService)
: base(organizationUnitAppService)
{
}
[HttpGet]
[Route("Unit-Category-lookup")]
public Task<PagedResultDto<LookupDto>> GetUnitCategoryLookupAsync(LookupRequestDto input)
{
return ((IAppOrganizationUnitAppService)OrganizationUnitAppService).GetUnitCategoryLookupAsync(input);
}
}
However when I attempt to start the HttpApi.Host project I now get the following exception:
Hi Support Team I have the same issue above ,I extending
my issue how to use dynamic controller to show the endpoint of the new method which I added in app service without extending OrganizationUnitController?
I tried to use [RemoteService(IsEnabled = false)] to prevent creating duplicate controller but the end point of new method not showing
I have one- to-many relationship between the following two classes WorkRoleTenantAssignment and Tenant.
I trying to get all WorkRoleTenantAssignment with Tenant Because tenant is an aggregate root and adding navigation property to aggregate roots is not allowed in Abp, I added new class below, similar to the classes generated by Abp suite
And I wrote the following Linq query to fetch data Work Roles Assignments along with their assigned tenants. When I run the code I got this following error: I have tried many ways to overcome this issue but with no luck. Your guidance is appreciated.