You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Zero/ZeroLevel/Services/DependencyInjection/Contracts/IParameterStorage.cs

79 lines
2.4 KiB

6 years ago
using System;
5 years ago
namespace ZeroLevel.DependencyInjection
6 years ago
{
/// <summary>
/// DI parameters stogare (string key and anytype value)
6 years ago
/// </summary>
public interface IParameterStorage
{
#region IEverythingStorage
6 years ago
/// <summary>
/// Save parameter
6 years ago
/// </summary>
/// <typeparam name="T">Parameter type</typeparam>
/// <param name="key">Key</param>
/// <param name="value">Parameter value</param>
6 years ago
void Save<T>(string key, T value);
6 years ago
/// <summary>
/// Save or update parameter
6 years ago
/// </summary>
/// <typeparam name="T">Parameter type</typeparam>
/// <param name="key">Key</param>
/// <param name="value">Parameter value</param>
6 years ago
void SaveOrUpdate<T>(string key, T value);
6 years ago
/// <summary>
/// Safe save parameter
6 years ago
/// </summary>
/// <typeparam name="T">Parameter type</typeparam>
/// <param name="key">Key</param>
/// <param name="value">Parameter value</param>
6 years ago
bool TrySave<T>(string key, T value);
6 years ago
/// <summary>
/// Remove parameter by key
6 years ago
/// </summary>
/// <typeparam name="T">Parameter type</typeparam>
/// <param name="key">Key</param>
6 years ago
void Remove<T>(string key);
6 years ago
/// <summary>
/// Safe remove parameter by key
6 years ago
/// </summary>
/// <typeparam name="T">Parameter type</typeparam>
/// <param name="key">Key</param>
6 years ago
bool TryRemove<T>(string key);
6 years ago
/// <summary>
/// Get parameter value by key
6 years ago
/// </summary>
/// <typeparam name="T">Parameter type</typeparam>
/// <param name="key">Key</param>
/// <returns>Parameter value</returns>
6 years ago
T Get<T>(string key);
6 years ago
T GetOrDefault<T>(string key);
6 years ago
T GetOrDefault<T>(string key, T defaultValue);
6 years ago
/// <summary>
/// Get parameter value by key
6 years ago
/// </summary>
/// <param name="type">Parameter type</param>
/// <param name="key">Key</param>
/// <returns>Parameter value</returns>
6 years ago
object Get(Type type, string key);
6 years ago
/// <summary>
/// Check for parameter existence by key
6 years ago
/// </summary>
/// <typeparam name="T">Parameter type</typeparam>
/// <param name="key">Key</param>
6 years ago
bool Contains<T>(string key);
#endregion IEverythingStorage
6 years ago
}
}

Powered by TurnKey Linux.