Base solution for your next web application

Activities of "payoff"

I know this is 2 years old, but am having the same issue (AspNetZero 9.3 NetCore + Angular)

Switching the language on the login page does not work.

The fact that the cookie is set by the client without the SameSite attribute might be correlated, see also https://github.com/aspnetzero/aspnet-zero-core/issues/3323

language-switch-component uses the client function abp.utils.setCookieValue, which does not set any same site attributes or secure flag when in HTTPS.

Any fix for any of this ?

@bobingham I know this might be quite old by now, but anyway, the way to override a class implementation in a separated module is this:

/// <summary>
///     Application layer module of the application.
/// </summary>
[DependsOn(typeof(MyCompanyApplicationSharedModule), typeof(MyCompanyCoreModule))]
public class MyCompanyAppModule : AbpModule
{
    ...
    public override void PreInitialize()
    {
       ...
        // register tenant registration app service override
        Configuration.ReplaceService(typeof(TenantRegistrationAppService), () => {
            Configuration.IocManager.IocContainer.Register(Component.For<TenantRegistrationAppService>()
                .ImplementedBy<MyCustomTenantRegistrationAppService>()
                .IsDefault());
        });
       ...
    }
    ...
}

The key config is the .IsDefault()); call, otherwise base implementation will continue to be the default ones.

@hra I had a similar requirement.

Generally we've adopted a strategy to keep the base ANZ code upgradeable, that consists in writing all additional implementation and overrides in a separated project that defines its own Module. With this premise, for customizing operations during new tenant registration I've ended up inheriting from TenantRegistrationAppService, marking its RegisterTenant method as virtual and overriding it in my inheriting class:

public class MyCustomTenantRegistrationAppService : TenantRegistrationAppService
{
        ....

        /// <summary>
        ///     Customize tenant registration operations
        /// </summary>
        [UnitOfWork]
        public override async Task<RegisterTenantOutput> RegisterTenant(RegisterTenantInput input){
                ...
                var registerTenantOutput = await base.RegisterTenant(input);
                ...
        }
}

The overriding implementation must be registered as default during the module's PreInitialize method:

/// <summary>
///     Application layer module of the application.
/// </summary>
[DependsOn(typeof(MyCompanyApplicationSharedModule), typeof(MyCompanyCoreModule))]
public class MyCompanyAppModule : AbpModule
{
    ...
    public override void PreInitialize()
    {
       ...
        // register tenant registration app service override
        Configuration.ReplaceService(typeof(TenantRegistrationAppService), () => {
            Configuration.IocManager.IocContainer.Register(Component.For<TenantRegistrationAppService>()
                .ImplementedBy<MyCustomTenantRegistrationAppService>()
                .IsDefault());
        });
       ...
    }
    ...
}

If you do not use implementations separation in a dedicated module, you can simply modify TenantRegistrationAppService.RegisterTenant.

Prerequisites

  • What is your product version?
  • aspnet zero 9.0
  • What is your product type (Angular or MVC)?
  • MVC
  • What is product framework type (.net framework or .net core)?
  • .net core Hello, I would need information on how to test an AbpController derived controller
Showing 1 to 4 of 4 entries