Open Closed

How to enable feature management #121


User avatar
0
rajasekhard2015 created

How to enable featue management at tenant level/edition level please give me one example for the enabling features at tenant level


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

    Feature system has not documented yet. It's purpose and usage is similar to https://aspnetboilerplate.com/Pages/Documents/Feature-Management.

    You can also refer to: https://github.com/abpframework/abp/blob/dev/docs/en/AspNet-Boilerplate-Migration-Guide.md#feature-management.

  • User Avatar
    0
    rajasekhard2015 created

    I am doing like this,

       public class TestAppFeaturesDefinitionProvider : FeatureDefinitionProvider
        {
            public override void Define(IFeatureDefinitionContext context)
            {
                var myGroup = context.AddGroup(TestAppFeatures.GroupName);
                myGroup.AddFeature(TestAppFeatures.Chat,"false", L("Feature:Chat"), L("Feature:Test:Description"),null,false);
            }
            private static LocalizableString L(string name)
            {
                return LocalizableString.Create<TestAppResource>(name);
            }
        }
    

    Is it Correct way?

    After adding this. i am getting this feature in edit edion features modal. but unable to see the proper way like checkboxes for enabling/disabling not showing properly

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    You can try ToggleStringValueType

    myGroup.AddFeature(TestAppFeatures.Chat,"false", L("Feature:Chat"), L("Feature:Test:Description"), new ToggleStringValueType() ,false);
    
  • User Avatar
    0
    Phiph created

    Hey Mailiming, I've tried the above in v2.9 and I get the following exception.

    - Could not create an instance of type Volo.Abp.Validation.StringValues.IStringValueType. Type is an interface or abstract class and cannot be instantiated. Path 'features[0].valueType.name', line 1, position 104. Newtonsoft.Json.JsonSerializationException: Could not create an instance of type Volo.Abp.Validation.StringValues.IStringValueType. Type is an interface or abstract class and cannot be instantiated. Path 'features[0].valueType.name', line 1, position 104. at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateNewObject(JsonReader reader, JsonObjectContract objectContract, JsonProperty containerMember, JsonProperty containerProperty, String id, Boolean& createdFromNonDefaultCreator) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.SetPropertyValue(JsonProperty property, JsonConverter propertyConverter, JsonContainerContract containerContract, JsonProperty containerProperty, JsonReader reader, Object target) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(Object newObject, JsonReader reader, JsonObjectContract contract, JsonProperty member, String id) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateList(IList list, JsonReader reader, JsonArrayContract contract, JsonProperty containerProperty, String id) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateList(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, Object existingValue, String id) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.SetPropertyValue(JsonProperty property, JsonConverter propertyConverter, JsonContainerContract containerContract, JsonProperty containerProperty, JsonReader reader, Object target) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(Object newObject, JsonReader reader, JsonObjectContract contract, JsonProperty member, String id) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent) at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType) at Newtonsoft.Json.JsonSerializer.Deserialize(JsonReader reader, Type objectType) at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings) at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value, JsonSerializerSettings settings) at Volo.Abp.Json.Newtonsoft.NewtonsoftJsonSerializer.Deserialize[T](String jsonString, Boolean camelCase) at Volo.Abp.Http.Client.DynamicProxying.DynamicHttpProxyInterceptor`1\.MakeRequestAndGetResultAsync\[T\]\(IAbpMethodInvocation invocation\)
    at Volo.Abp.Http.Client.DynamicProxying.DynamicHttpProxyInterceptor`1.GetResultAsync(Task task, Type resultType) at Volo.Abp.Http.Client.DynamicProxying.DynamicHttpProxyInterceptor`1.InterceptAsync(IAbpMethodInvocation invocation)
    at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter`1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func`3 proceed)
    at Castle\.DynamicProxy\.AsyncInterceptorBase\.ProceedAsynchronous\[TResult\]\(IInvocation invocation\, IInvocationProceedInfo proceedInfo\)
    at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue`1.ProceedAsync() at Volo.Abp.Validation.ValidationInterceptor.InterceptAsync(IAbpMethodInvocation invocation) at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter`1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func`3 proceed) at Volo.Abp.FeatureManagement.Web.Pages.FeatureManagement.FeatureManagementModal.OnGetAsync() at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.ExecutorFactory.NonGenericTaskHandlerMethod.Execute(Object receiver, Object[] arguments) at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker.InvokeHandlerMethodAsync() at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker.InvokeNextPageFilterAsync()
    

    Here is my definition provider that I've been testing with.

        public class AppFeaturesDefinitionProvider : FeatureDefinitionProvider
        {
            public override void Define(IFeatureDefinitionContext context)
            {
                var myGroup = context.AddGroup("Hello");
                myGroup.AddFeature("Chat", defaultValue: "false", valueType: new ToggleStringValueType(new BooleanValueValidator()));
            }
    
            private static LocalizableString L(string name)
            {
                return LocalizableString.Create<ConquestResource>(name);
            }
        }
    

    Even while the AddFeature line is as below, it still doesn't work.

    myGroup.AddFeature("Chat", defaultValue: "false", valueType: new ToggleStringValueType());
    
  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi, I can't reproduce your problem. Can you provider steps to reproduce?

Made with ❤️ on ABP v8.2.0-preview Updated on March 25, 2024, 15:11