This repository has been archived by the owner on Dec 8, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ISettingsRepository.cs
50 lines (45 loc) · 2.86 KB
/
ISettingsRepository.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// <copyright file="ISettingsRepository.cs" company="Engage Software">
// DotNetNuke.SettingsRepository
// Copyright (c) 2004-2014
// by Engage Software ( http://www.engagesoftware.com )
// </copyright>
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
// TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
// CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
namespace DotNetNuke.SettingsRepository
{
using System;
/// <summary>A contract specifying the ability to get and set settings</summary>
public interface ISettingsRepository
{
/// <summary>Determines whether the specified setting has any value.</summary>
/// <typeparam name="T">The type of the setting's value</typeparam>
/// <param name="setting">The setting.</param>
/// <returns><c>true</c> if the specified setting has a value; otherwise, <c>false</c>.</returns>
bool HasValue<T>(Setting<T> setting);
/// <summary>Gets the value of the setting.</summary>
/// <typeparam name="T">The type of the setting's value</typeparam>
/// <param name="setting">The setting.</param>
/// <returns>The setting's value (returns the default value of the setting if it hasn't been set yet)</returns>
T GetValue<T>(Setting<T> setting);
/// <summary>Gets the value of the setting.</summary>
/// <typeparam name="T">The type of the setting's value</typeparam>
/// <param name="setting">The setting.</param>
/// <param name="converter">A function which converts the string representation of the value into <typeparamref name="T"/>.</param>
/// <returns>The setting's value (returns the default value of the setting if it hasn't been set yet)</returns>
T GetValue<T>(Setting<T> setting, Func<string, T> converter);
/// <summary>Sets the value of the setting.</summary>
/// <typeparam name="T">The type of the setting's value</typeparam>
/// <param name="setting">The setting.</param>
/// <param name="value">The value.</param>
void SetValue<T>(Setting<T> setting, T value);
/// <summary>Sets the value of the setting.</summary>
/// <typeparam name="T">The type of the setting's value</typeparam>
/// <param name="setting">The setting.</param>
/// <param name="value">The value.</param>
/// <param name="converter">A function which converts the value into its string representation.</param>
void SetValue<T>(Setting<T> setting, T value, Func<T, string> converter);
}
}