Ends in:
5 DAYS
4 HRS
5 MIN
1 SEC
Ends in:
5 D
4 H
5 M
1 S
Open Closed

Features management and checking not synchronized #1626


User avatar
0
FabriceC created
  • ABP Framework version: v4.0.0.0
  • UI type: MVC
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): no
  • Exception message and stack trace:
  • Steps to reproduce the issue:"

Hi,

i have a multi-tenant architecture. I have set up different features according to the tenants.

Tenant 1 : Products.Blazer = true, Products.Trouser = true Tenant 2 : Products.Blazer = false, Products.Trouser = true

I use this code in application.contracts and it works :

public override void Define(IFeatureDefinitionContext context)
{
    var productsType = context.AddGroup("Products", displayName: LocalizableString.Create<OrdersAppResource>("Products"));

    productsType.AddFeature(
        "Products.Blazer",
        defaultValue: "true",
        displayName: LocalizableString.Create<OrdersAppResource>("Blazer"),
        valueType: new ToggleStringValueType()
    );

    productsType.AddFeature(
        "Products.Trouser",
        defaultValue: "true",
        displayName: LocalizableString.Create<OrdersAppResource>("Trouser"),
        valueType: new ToggleStringValueType()
    );
}

The database is ready. Datas in the Features table is those defined from the interface. But, reading the features according to the tenant always gives the same result, the one set by default. I used IFeatureManager and IFeatureChecker.

Best regards.


7 Answer(s)
  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    I will check it out.

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    I can't reproduce the problem, can you provide more infomartion?

    public async Task OnGetAsync()
    {
        if (CurrentUser.IsAuthenticated)
        {
            var stringBuilder = new StringBuilder();
            stringBuilder.AppendLine($"Current tenant: {CurrentTenant.Name}");
            stringBuilder.AppendLine($"  Products.Blazer: {await _featureChecker.IsEnabledAsync("Products.Blazer")}");
            stringBuilder.AppendLine($"  Products.Blazer: {await _featureChecker.IsEnabledAsync("Products.Trouser")}");
    
            Features = stringBuilder.ToString();
        }
    }
    

  • User Avatar
    0
    FabriceC created

    Hi,

    here is some additional information. I use Application StartUp Template with Lepton Theme. The values assigned in the administration interface are effective a few hours, I don't know exactly how much. Is there a cache problem ?

    Here are values in the database, they do not change :

    But in ApplicationConfigurationSript, values are differents, as well as the values obtained with IfeatureManager and IFeatureChecker :

        features: {
            values: {
                "Identity.TwoFactor": "Optional",
                "FileManagement.Enable": "True",
                "FileManagement.StorageSize": "0",
                "Account.EnableLdapLogin": "False",
                "Products.Blazer": "True",
                "Products.Trouser": "True",
            }
        },
        
    

    Best regards.

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    Sorry, but this information is not enough for me to reproduce the problem

    Can you create a project to reproduce? thanks. you can send it to my email : shiwei.liang@volosoft.com

  • User Avatar
    0
    FabriceC created

    Hi,

    I notice that it works well with a shared database but not with separate databases. The Abp tenant, featuresvalues, and editions tables are empty in separate bases. I will try to create a dedicated project.

    Best regards.

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    Okay, thanks.

  • User Avatar
    0
    FabriceC created

    Hi,

    I have updated to version 4.3.1 and it works fine.

    Thanks.

Made with ❤️ on ABP v9.1.0-preview. Updated on November 26, 2024, 12:49