Activities of "DanielAndreasen"

Answer

In the thread "Bug & Issues V3.1.X" (which seems to have been removed now) I have previously reported an issue regarding logging of password in plain text.

After upgrading our project from 3.1.0 to 3.3.0 the issue is still present as shown below.

Endpoint called: Log result:

We simply followed this guide when upgrading our existing project. NPM and NuGet packages has been updated to latest versions.

Are we missing some abp version upgrade steps or has this issue just not yet been solved?

ABP Version: 3.3.0 Frontend type: Angular

@alper Yes we are still running v3.1 with plans to upgrade to v3.3 when it releases, however I was not able find anyone mentioning this issue in any thread or as part of the release notes so I wanted to know if it has been resolved.

Fronted is Angular.

When selecting multiple datepicker input in a CRUD-page the previously selected datepicker window is not closed which results in multiple windows overlapping eachother:

This issue also occurs when selecting multiple datepicker input fields on the window that is presented when creating new entities in the standard CRUD-pages:

Additionally, there is no obvious way for the user to navigate between months or years in the datepicker.

I think remote help is a very good idea – how do we set this up?

I have sent the project to you on Mail

Perhaps I am missing some dependecies or configuration of dependency injection? Can you show which dependecies is used in the working example you presented?

I am experiencing the same problem in a project build on the startup template (eventhandler and dependant classes placed in the .Host project)

Project structure of RabbitMQ consumer implementation in a project based on startup template

Below is the full structure of our main project and the SensorData "microservice"

Main method in Program.cs

Im attempting to inject a repository generated with the ABP suite in a class which implements the IDistributedEventHandler interface. RabbitMQ is configured as the distributed event bus provider.

The documentation describes that "You can inject any service and perform any required logic here..." in context of subscribing to events with IDistributedEventHandler. However when I inject repositories or other classes which is registered to dependency injection with the ITransientDependency interface, the eventhandler is never instantiated. It seems like the eventhandler is only configured properly if it contains either a empty constructor or a constructor with IDistributedEventBus as parameter.

The following implementation should illustrate what I wish to accomplish:

using Stella.GGSensorData;
using System.Threading.Tasks;
using Volo.Abp.DependencyInjection;
using Volo.Abp.EventBus.Distributed;

 public class GGSensorDataHandler : IDistributedEventHandler<GGSensorDataEntity>, ITransientDependency
    {
        private readonly IGGSensorDataRepository _gGsensorDataRepository;
        private readonly RawSensorDataParser _rawSensorDataParser;


        public GGSensorDataHandler(RawSensorDataParser rawSensorDataParser, IGGSensorDataRepository gGSensorDataRepository)
        {
            _rawSensorDataParser = rawSensorDataParser;
            _gGsensorDataRepository = gGSensorDataRepository;
        }

        public async Task HandleEventAsync(GGSensorDataEntity eventData)
        {
            await _rawSensorDataParser.ParseAndInsertRawSensorData(eventData);
            await InsertRawSensorDataStellaDb(eventData);
        }

        private async Task InsertRawSensorDataStellaDb(GGSensorDataEntity sensorData)
        {
            sensorData.Json = JsonSerializer.Serialize(sensorData);

            await _gGsensorDataRepository.InsertAsync(sensorData);
        }

How do I properly inject repositories/services in a class that implements IDistributedEventHandler like above?

I should note that the "GGSensorDataHandler" class is implemented in a project separate to our main ABP project and references the repositories via a project reference dependency:

The intention is simply to implement the project as a microservice.

Unit of work Using Unit of work as suggested here and similarly in the abp documentation does not solve this issue.

Project Details

  • ABP Framework version: v3.2.1
  • Project Type: .Net Core console app

My issue is not solved by the solution mentioned in that link.

It seems like the endpoints from the organizationunitcontroller in the identity module has been duplicated after I made an override of the controller. The examples of calls to endpoints that originates from the identity modules is illustrated below along with the errors I receive:

localhost/api/identity/organization-units

Microsoft.AspNetCore.Routing.Matching.AmbiguousMatchException: The request matched multiple endpoints. Matches: 

Stella.Controllers.OrganizationUnits.AppOrganizationUnitController.GetListAsync (Stella.HttpApi)
Volo.Abp.Identity.OrganizationUnitController.GetListAsync (Volo.Abp.Identity.Pro.HttpApi)

localhost/api/identity/organization-units/{id}

Microsoft.AspNetCore.Routing.Matching.AmbiguousMatchException: The request matched multiple endpoints. Matches: 

Stella.Controllers.OrganizationUnits.AppOrganizationUnitController.GetAsync (Stella.HttpApi)
Volo.Abp.Identity.OrganizationUnitController.GetAsync (Volo.Abp.Identity.Pro.HttpApi)

That seems to fix the problem, thank you.

Now my final issue is related to the controller routing, but this seems to be a known issue.

When overriding methods from a module controller like I have done with OrganizationUnitController it will create routing conflicts when any endpoints are called (even though I have not made changes to the virtual controller methods originating from the module) and throw an exception: "Microsoft.AspNetCore.Routing.Matching.AmbiguousMatchException: The request matched multiple endpoints".

Have you found a solution to this issue or is it planned as part of the 3.3 milestone?

I have implemented the following based on the solution you suggested:

  public interface IAppOrganizationUnitRepository : IOrganizationUnitRepository
    {
        public Task<List<MonitoredObject>> GetMonitoredObjectsAsync(Guid organizationUnitId, CancellationToken cancellationToken = default);
    }

    [Dependency(ReplaceServices = true)]
    [ExposeServices(typeof(EfCoreOrganizationUnitRepository), typeof(IAppOrganizationUnitRepository))]
    public class EfCoreAppOrganizationUnitRepository : EfCoreOrganizationUnitRepository, IAppOrganizationUnitRepository
    {

        private readonly IDbContextProvider<StellaDbContext> _stellaDBContext;

        public EfCoreAppOrganizationUnitRepository(IDbContextProvider<IIdentityDbContext> dbContextProvider, IDbContextProvider<StellaDbContext> stellaDbContext)
            : base(dbContextProvider)
        {
            _stellaDBContext = stellaDbContext;
        }
        public async Task<List<MonitoredObject>> GetMonitoredObjectsAsync(
            Guid organizationUnitId, CancellationToken cancellationToken = default)
        {

            var query = from organizationUnitMonitoredObjectLink in _stellaDBContext.GetDbContext().OrganizationUnitMonitoredObjectLinks
                        join monitoredObject in _stellaDBContext.GetDbContext().MonitoredObjects on organizationUnitMonitoredObjectLink.MonitoredObjectId equals monitoredObject.Id
                        where organizationUnitMonitoredObjectLink.MonitoredObjectId == organizationUnitId
                        select monitoredObject;

            return await query.ToListAsync(GetCancellationToken(cancellationToken));
        }
    }

    [Dependency(ReplaceServices = true)]
    [ExposeServices(typeof(OrganizationUnitManager),typeof(IAppOrganizationUnitAppService))]
    public class OrganizationUnitsAppService : OrganizationUnitAppService, IAppOrganizationUnitAppService
    {
        public OrganizationUnitsAppService(OrganizationUnitManager organizationUnitManager,
            IdentityUserManager userManager,
            IOrganizationUnitRepository organizationUnitRepository,
            IIdentityUserRepository identityUserRepository,
            IIdentityRoleRepository identityRoleRepository)
            : base(organizationUnitManager, userManager, organizationUnitRepository, identityUserRepository, identityRoleRepository)
        {

        }

        public async Task<List<MonitoredObjectDto>> GetMonitoredObjectsAsync(Guid id)
        {
            var monitoredObjects = await ((IAppOrganizationUnitRepository)OrganizationUnitRepository).GetMonitoredObjectsAsync(id);
            return ObjectMapper.Map<List<MonitoredObject>,List<MonitoredObjectDto>>(monitoredObjects);
        }

    }

    [Dependency(ReplaceServices = true)]
    [ExposeServices(typeof(OrganizationUnitController),typeof(IAppOrganizationUnitAppService))]
    public class AppOrganizationUnitController : OrganizationUnitController, IAppOrganizationUnitAppService
    {
        public AppOrganizationUnitController(IOrganizationUnitAppService organizationUnitAppService)
            : base(organizationUnitAppService)
        {

        }

        [HttpGet]
        [Route("{id}/monitoredObjects")]
        public Task<List<MonitoredObjectDto>> GetMonitoredObjectsAsync(Guid id)
        {
            return ((IAppOrganizationUnitAppService)OrganizationUnitAppService).GetMonitoredObjectsAsync(id);
        }
    }

However when I attempt to start the HttpApi.Host project I now get the following exception:

Showing 21 to 30 of 39 entries
Made with ❤️ on ABP v8.2.0-preview Updated on March 25, 2024, 15:11