Base solution for your next web application
Ends in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

extending AbpSettings to include an EntityIdentifier #9156


User avatar
0
sedulen created

good morning everyone. I hope everyone is staying healthy & safe.

I'm working on a feature on my project where we want to enable notifications @ an entity level. We have this working great for the individual notifications, using the AbpNotificationSubscriptions table and the INotificationSubscriptionManager and EntityIdentifier However, also need the ability to turn notifications on/off for the entire entity, just like a user can for enabling or disabling notifications.

Looking at how the framework handles enabling or disabling notifications using AbpSettings and SettingsManager and the Abp.Notifications.ReceiveNotifications notification name. Unfortunately, the scopes for AbpSettings appears to be Application, Tenant, and User, so there isn't a built-in way for an AbpSetting to support an Entity scope, like Notifications are.

The idea is similar to how settings can be applied to multiple scopes, where the APPLICATION can define a setting that is then overridden by a TENANT, which then can be overridded by a USER. I love this design pattern, and would like to extend it 1 level further, to were a USER could override a setting for a given ENTITY.

To note, I'm running older versions of ANZ (6.9.0) and ABP (4.5.0), so this might be implemented in a newer release. I will check shortly.

Would you recommend trying to extend AbpSettings and SettingsManager to support and Entity scope? or instead would you recommend creating a new entity entirely and just storing the values separately?

Ultimately what I'm looking to implement is a user's ability to control subscriptions to notifications both Globally as well as specifically for a single Entity. So controls like: 1.) turn on Notification X globally, but turn it off for Record A. 2.) turn off Notification X globally, but turn it on for Record A.

Thanks everyone!


1 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @sedulen,

    We are fine and safe, thank you :). I hope you are too.

    You can follow two approaches here;

    1. You can put entity information into customData of the related setting (see https://aspnetboilerplate.com/Pages/Documents/Setting-Management) and use it when publishing a notification.
    2. If that doesn't solve your problem, it is better to use a new entity for storing your entity notification settings. Adding a new scope to current setting scopes will be harder.