Reputation: 44
I am developing an event management application with ASP.NET Boilerplate and Module Zero.
The features management included with ASP.NET Boilerplate allows to scope features to an Edition or to a Tenant.
I would like to know if it's possible to extend features to be scoped to events, so I can assign specific features of our application individually to each event our tenants create.
Is this possible? What is the best way to implement this with ABP?
Upvotes: 0
Views: 1603
Reputation: 43098
I would like to know if it's possible to extend features to be scoped to events... Is this possible?
Sure. You can:
Feature
FeatureSetting
FeatureScopes
enum to include Events
IFeatureChecker
IFeatureManager
FeatureValueStore
That looks like a lot of work. But it is done like that for maintainability and separation of concerns.
What is the best way to implement this with ABP?
You're better off using Feature
as-is, enabled for the tenant, and then replace FeatureChecker
:
public async Task<string> GetValueAsync(int tenantId, string name)
{
var feature = _featureManager.Get(name);
var value = await FeatureValueStore.GetValueOrNullAsync(tenantId, feature);
if (value == null)
{
return feature.DefaultValue;
}
// Check if Feature is enabled for Event
// ...
return value;
}
Upvotes: 2