using System.Linq.Expressions; using Nop.Core.Configuration; using Nop.Core.Domain.Configuration; namespace Nop.Services.Configuration; /// /// Setting service interface /// public partial interface ISettingService { /// /// Gets a setting by identifier /// /// Setting identifier /// /// A task that represents the asynchronous operation /// The task result contains the setting /// Task GetSettingByIdAsync(int settingId); /// /// Gets a setting by identifier /// /// Setting identifier /// /// The setting /// Setting GetSettingById(int settingId); /// /// Deletes a setting /// /// Setting /// A task that represents the asynchronous operation Task DeleteSettingAsync(Setting setting); /// /// Deletes a setting /// /// Setting void DeleteSetting(Setting setting); /// /// Deletes settings /// /// Settings /// A task that represents the asynchronous operation Task DeleteSettingsAsync(IList settings); /// /// Get setting by key /// /// Key /// Store identifier /// A value indicating whether a shared (for all stores) value should be loaded if a value specific for a certain is not found /// /// A task that represents the asynchronous operation /// The task result contains the setting /// Task GetSettingAsync(string key, int storeId = 0, bool loadSharedValueIfNotFound = false); /// /// Get setting by key /// /// Key /// Store identifier /// A value indicating whether a shared (for all stores) value should be loaded if a value specific for a certain is not found /// /// The setting /// Setting GetSetting(string key, int storeId = 0, bool loadSharedValueIfNotFound = false); /// /// Get setting value by key /// /// Type /// Key /// Store identifier /// Default value /// A value indicating whether a shared (for all stores) value should be loaded if a value specific for a certain is not found /// /// A task that represents the asynchronous operation /// The task result contains the setting value /// Task GetSettingByKeyAsync(string key, T defaultValue = default, int storeId = 0, bool loadSharedValueIfNotFound = false); /// /// Get setting value by key /// /// Type /// Key /// Store identifier /// Default value /// A value indicating whether a shared (for all stores) value should be loaded if a value specific for a certain is not found /// /// Setting value /// T GetSettingByKey(string key, T defaultValue = default, int storeId = 0, bool loadSharedValueIfNotFound = false); /// /// Set setting value /// /// Type /// Key /// Value /// Store identifier /// A value indicating whether to clear cache after setting update /// A task that represents the asynchronous operation Task SetSettingAsync(string key, T value, int storeId = 0, bool clearCache = true); /// /// Set setting value /// /// Type /// Key /// Value /// Store identifier /// A value indicating whether to clear cache after setting update void SetSetting(string key, T value, int storeId = 0, bool clearCache = true); /// /// Gets all settings /// /// /// A task that represents the asynchronous operation /// The task result contains the settings /// Task> GetAllSettingsAsync(); /// /// Gets all settings /// /// /// Settings /// IList GetAllSettings(); /// /// Determines whether a setting exists /// /// Entity type /// Property type /// Settings /// Key selector /// Store identifier /// /// A task that represents the asynchronous operation /// The task result contains the true -setting exists; false - does not exist /// Task SettingExistsAsync(T settings, Expression> keySelector, int storeId = 0) where T : ISettings, new(); /// /// Determines whether a setting exists /// /// Entity type /// Property type /// Settings /// Key selector /// Store identifier /// /// The true -setting exists; false - does not exist /// bool SettingExists(T settings, Expression> keySelector, int storeId = 0) where T : ISettings, new(); /// /// Load settings /// /// Type /// Store identifier for which settings should be loaded /// A task that represents the asynchronous operation Task LoadSettingAsync(int storeId = 0) where T : ISettings, new(); /// /// Load settings /// /// Type /// Store identifier for which settings should be loaded /// Settings T LoadSetting(int storeId = 0) where T : ISettings, new(); /// /// Load settings /// /// Type /// Store identifier for which settings should be loaded /// A task that represents the asynchronous operation Task LoadSettingAsync(Type type, int storeId = 0); /// /// Load settings /// /// Type /// Store identifier for which settings should be loaded /// Settings ISettings LoadSetting(Type type, int storeId = 0); /// /// Save settings object /// /// Type /// Store identifier /// Setting instance /// A task that represents the asynchronous operation Task SaveSettingAsync(T settings, int storeId = 0) where T : ISettings, new(); /// /// Save settings object /// /// Type /// Store identifier /// Setting instance void SaveSetting(T settings, int storeId = 0) where T : ISettings, new(); /// /// Save settings object /// /// Entity type /// Property type /// Settings /// Key selector /// Store ID /// A value indicating whether to clear cache after setting update /// A task that represents the asynchronous operation Task SaveSettingAsync(T settings, Expression> keySelector, int storeId = 0, bool clearCache = true) where T : ISettings, new(); /// /// Save settings object /// /// Entity type /// Property type /// Settings /// Key selector /// Store ID /// A value indicating whether to clear cache after setting update void SaveSetting(T settings, Expression> keySelector, int storeId = 0, bool clearCache = true) where T : ISettings, new(); /// /// Save settings object (per store). If the setting is not overridden per store then it'll be delete /// /// Entity type /// Property type /// Settings /// Key selector /// A value indicating whether to setting is overridden in some store /// Store ID /// A value indicating whether to clear cache after setting update /// A task that represents the asynchronous operation Task SaveSettingOverridablePerStoreAsync(T settings, Expression> keySelector, bool overrideForStore, int storeId = 0, bool clearCache = true) where T : ISettings, new(); /// /// Adds a setting /// /// Setting /// A value indicating whether to clear cache after setting update /// A task that represents the asynchronous operation Task InsertSettingAsync(Setting setting, bool clearCache = true); /// /// Adds a setting /// /// Setting /// A value indicating whether to clear cache after setting update void InsertSetting(Setting setting, bool clearCache = true); /// /// Updates a setting /// /// Setting /// A value indicating whether to clear cache after setting update /// A task that represents the asynchronous operation Task UpdateSettingAsync(Setting setting, bool clearCache = true); /// /// Updates a setting /// /// Setting /// A value indicating whether to clear cache after setting update void UpdateSetting(Setting setting, bool clearCache = true); /// /// Delete all settings /// /// Type /// A task that represents the asynchronous operation Task DeleteSettingAsync() where T : ISettings, new(); /// /// Delete settings object /// /// Entity type /// Property type /// Settings /// Key selector /// Store ID /// A task that represents the asynchronous operation Task DeleteSettingAsync(T settings, Expression> keySelector, int storeId = 0) where T : ISettings, new(); /// /// Clear cache /// /// A task that represents the asynchronous operation Task ClearCacheAsync(); /// /// Clear cache /// void ClearCache(); /// /// Get setting key (stored into database) /// /// Type of settings /// Property type /// Settings /// Key selector /// Key string GetSettingKey(TSettings settings, Expression> keySelector) where TSettings : ISettings, new(); }