abpframework / abp

Open-source web application framework for ASP.NET Core! Offers an opinionated architecture to build enterprise software solutions with best practices on top of the .NET. Provides the fundamental infrastructure, cross-cutting-concern implementations, startup templates, application modules, UI themes, tooling and documentation.
https://abp.io
GNU Lesser General Public License v3.0
12.77k stars 3.41k forks source link

How to use FeatureDefinition’s AllowedProviders to filter feature list #2663

Closed SmallShrimp closed 4 years ago

SmallShrimp commented 4 years ago

I think the "AllowedProviders" attribute should be used to filter the "FeatureDefinition" list,like FeatureDefinitionManager.GetAll(string providerName).I'd like to get a different list of features in different place.For example, I need to add a product management module that makes a difference for different versions of the products that can be used.The products here are special features,but I don't want to see them in tenant management. And it can only be seen in product management

hikalkan commented 4 years ago

Feature system is used in a multi-tenant/SaaS application to grant/prohibit certain features. In this way Tenant A can use a feature while Tenant B can't use it.

This is not documented yet, but you can check the ASP.NET Boilerplate document to get the idea: https://aspnetboilerplate.com/Pages/Documents/Feature-Management

If I would directly answer your question, it is really simple:

var featuresOfMyProvider = featureDefinitionManager.GetAll().Where(f => f.AllowedProviders.Contains("MyProvider"));

Provides here are "Tenant", "Edition" and so on... not the features or modules of your application.