Base solution for your next web application
Ends in:
01 DAYS
01 HRS
01 MIN
01 SEC

Activities of "nikschuiling"

This works correctly, thank you. Should I always call UnitOfWorkManager.Current.EnableFilter(AbpDataFilters.MustHaveTenant) before calling UnitOfWorkManager.Current.SetTenantId or is the observed behaviour considered a bug?

Is your GetFinancialConnector method called over an iterface?

Yes it is.

How do you inject it while using.

In the console app I use AbpBootstrapper. To resolve IFinancialConnectorService I use:

IFinancialConnectorService financialConnectorService = IocManager.Instance.Resolve<IFinancialConnectorService>();

Also, is it application service?

No, the base class of FinancialConnectorService is MyAppServiceBase. FinancialConnectorService furthermore implements ITransientDependency.

Did you try to make this method virtual?

Yes, this doesn't change anything.

Hi,

I have the following code:

[UnitOfWork]
        public async Task GetFinancialConnector(AdministrationIdentifier administration)
        {
            var results1 = _administrationRepository.GetAllList(); // Returns all 8 administrations --> correct

            UnitOfWorkManager.Current.SetTenantId(administration.TenantId);
            
            var results2 = _administrationRepository.GetAllList(); // Returns 0 administrations --> incorrect!

            UnitOfWorkManager.Current.SetTenantId(administration.TenantId);

            var results3 = _administrationRepository.GetAllList(); // Returns all 8 administrations --> correct
            
        }

Administration implements IMustHaveTenant. This method is called with a non null value for administration.TenantId, e.g. 1.

After calling SetTenantId the first time _administrationRepository.GetAllList() doesn't return any results. At this moment FilterParameter MustHaveTenant has no parameters, which is strange because SetTenantId was called before with a tenant id. After calling SetTenantId the second time _administrationRepository.GetAllList() returns the correct results. At this moment the parameter of MustHaveTenant is correctly set.

Can someone clarify why calling SetTenantId once doesn't give the desired result?

Note: this code is running in a console app. AbpSession.TenantId is null. If I register a custom IAbpSession and set TenantId to a non null value, calling SetTenantId once works perfectly.

Thanks.

Kind regards,

Nik

Showing 1 to 3 of 3 entries