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/IContainerRegister.cs

331 lines
17 KiB

6 years ago
using System;
5 years ago
namespace ZeroLevel.DependencyInjection
6 years ago
{
/// <summary>
/// Methods for register contact resolvings
/// (singletones and multitones)
6 years ago
/// </summary>
public interface IContainerRegister : IDisposable
{
#region Register
6 years ago
/// <summary>
/// Dependency resolution registration
6 years ago
/// </summary>
/// <typeparam name="TContract">Contract</typeparam>
/// <typeparam name="TImplementation">Dependency resolution</typeparam>
6 years ago
void Register<TContract, TImplementation>();
6 years ago
/// <summary>
/// Dependency resolution registration
6 years ago
/// </summary>
/// <typeparam name="TContract">Contract</typeparam>
/// <typeparam name="TImplementation">Dependency resolution</typeparam>
/// <param name="resolveName">Dependency name</param>
6 years ago
void Register<TContract, TImplementation>(string resolveName);
6 years ago
/// <summary>
/// Dependency resolution registration
6 years ago
/// </summary>
/// <typeparam name="TContract">Contract</typeparam>
/// <typeparam name="TImplementation">Dependency resolution</typeparam>
/// <param name="shared">true - for singletone</param>
6 years ago
void Register<TContract, TImplementation>(bool shared);
6 years ago
/// <summary>
/// Dependency resolution registration
6 years ago
/// </summary>
/// <typeparam name="TContract">Contract</typeparam>
/// <typeparam name="TImplementation">Dependency resolution</typeparam>
/// <param name="resolveName">Dependency name</param>
/// <param name="shared">true - for singletone</param>
6 years ago
void Register<TContract, TImplementation>(string resolveName, bool shared);
/// <summary>
/// Dependency resolution registration
6 years ago
/// </summary>
/// <param name="contractType">Contract</param>
/// <param name="implementationType">Dependency resolution</param>
6 years ago
void Register(Type contractType, Type implementationType);
6 years ago
/// <summary>
/// Dependency resolution registration
6 years ago
/// </summary>
/// <param name="contractType">Contract</param>
/// <param name="implementationType">Dependency resolution</param>
/// <param name="resolveName">Dependency name</param>
6 years ago
void Register(Type contractType, Type implementationType, string resolveName);
6 years ago
/// <summary>
/// Dependency resolution registration
6 years ago
/// </summary>
/// <param name="contractType">Contract</param>
/// <param name="implementationType">Dependency resolution</param>
/// <param name="shared">true - for singletone</param>
6 years ago
void Register(Type contractType, Type implementationType, bool shared);
6 years ago
/// <summary>
/// Dependency resolution registration
6 years ago
/// </summary>
/// <param name="contractType">Contract</param>
/// <param name="implementationType">Dependency resolution</param>
/// <param name="resolveName">Dependency name</param>
/// <param name="shared">true - for singletone</param>
6 years ago
void Register(Type contractType, Type implementationType, string resolveName, bool shared);
#endregion Register
6 years ago
#region Register with parameters
6 years ago
/// <summary>
/// Dependency resolution registration with constructor parameters
6 years ago
/// </summary>
/// <typeparam name="TContract">Contract</typeparam>
/// <typeparam name="TImplementation">Dependency resolution</typeparam>
/// <param name="constructorParameters">Ctor args</param>
6 years ago
void ParameterizedRegister<TContract, TImplementation>(object[] constructorParameters);
6 years ago
/// <summary>
/// Dependency resolution registration with constructor parameters
6 years ago
/// </summary>
/// <typeparam name="TContract">Contract</typeparam>
/// <typeparam name="TImplementation">Dependency resolution</typeparam>
/// <param name="resolveName">Dependency name</param>
/// <param name="constructorParameters">Ctor args</param>
6 years ago
void ParameterizedRegister<TContract, TImplementation>(string resolveName, object[] constructorParameters);
6 years ago
/// <summary>
/// Dependency resolution registration with constructor parameters
6 years ago
/// </summary>
/// <typeparam name="TContract">Contract</typeparam>
/// <typeparam name="TImplementation">Dependency resolution</typeparam>
/// <param name="shared">true - for singletone</param>
/// <param name="constructorParameters">Ctor args</param>
6 years ago
void ParameterizedRegister<TContract, TImplementation>(bool shared, object[] constructorParameters);
6 years ago
/// <summary>
/// Dependency resolution registration with constructor parameters
6 years ago
/// </summary>
/// <typeparam name="TContract">Contract</typeparam>
/// <typeparam name="TImplementation">Dependency resolution</typeparam>
/// <param name="resolveName">Dependency name</param>
/// <param name="shared">true - for singletone</param>
/// <param name="constructorParameters">Ctor args</param>
6 years ago
void ParameterizedRegister<TContract, TImplementation>(string resolveName, bool shared, object[] constructorParameters);
6 years ago
/// <summary>
/// Dependency resolution registration with constructor parameters
6 years ago
/// </summary>
/// <param name="contractType">Contract</param>
/// <param name="implementationType">Dependency resolution</param>
/// <param name="constructorParameters">Ctor args</param>
6 years ago
void ParameterizedRegister(Type contractType, Type implementationType, object[] constructorParameters);
6 years ago
/// <summary>
/// Dependency resolution registration with constructor parameters
6 years ago
/// </summary>
/// <param name="contractType">Contract</param>
/// <param name="implementationType">Dependency resolution</param>
/// <param name="resolveName">Dependency name</param>
/// <param name="constructorParameters">Ctor args</param>
6 years ago
void ParameterizedRegister(Type contractType, Type implementationType, string resolveName, object[] constructorParameters);
6 years ago
/// <summary>
/// Dependency resolution registration with constructor parameters
6 years ago
/// </summary>
/// <param name="contractType">Contract</param>
/// <param name="implementationType">Dependency resolution</param>
/// <param name="shared">true - for singletone</param>
/// <param name="constructorParameters">Ctor args</param>
6 years ago
void ParameterizedRegister(Type contractType, Type implementationType, bool shared, object[] constructorParameters);
6 years ago
/// <summary>
/// Dependency resolution registration with constructor parameters
6 years ago
/// </summary>
/// <param name="contractType">Contract</param>
/// <param name="implementationType">Dependency resolution</param>
/// <param name="resolveName">Dependency name</param>
/// <param name="shared">true - for singletone</param>
/// <param name="constructorParameters">Ctor args</param>
6 years ago
void ParameterizedRegister(Type contractType, Type implementationType, string resolveName, bool shared, object[] constructorParameters);
#endregion Register with parameters
6 years ago
#region Safe register
6 years ago
/// <summary>
/// Safe dependency resolution registration
6 years ago
/// </summary>
/// <typeparam name="TContract">Contract</typeparam>
/// <typeparam name="TImplementation">Dependency resolution</typeparam>
/// <param name="fallback">Error handler</param>
/// <returns>true - registration successfully completed</returns>
7 months ago
bool TryRegister<TContract, TImplementation>(Action<Exception> fallback = null!);
6 years ago
/// <summary>
/// Safe dependency resolution registration
6 years ago
/// </summary>
/// <typeparam name="TContract">Contract</typeparam>
/// <typeparam name="TImplementation">Dependency resolution</typeparam>
/// <param name="resolveName">Dependency name</param>
/// <param name="fallback">Error handler</param>
/// <returns>true - registration successfully completed</returns>
7 months ago
bool TryRegister<TContract, TImplementation>(string resolveName, Action<Exception> fallback = null!);
6 years ago
/// <summary>
/// Safe dependency resolution registration
6 years ago
/// </summary>
/// <typeparam name="TContract">Contract</typeparam>
/// <typeparam name="TImplementation">Dependency resolution</typeparam>
/// <param name="shared">true - for singletone</param>
/// <param name="fallback">Error handler</param>
/// <returns>true - registration successfully completed</returns>
7 months ago
bool TryRegister<TContract, TImplementation>(bool shared, Action<Exception> fallback = null!);
6 years ago
/// <summary>
/// Safe dependency resolution registration
6 years ago
/// </summary>
/// <typeparam name="TContract">Contract</typeparam>
/// <typeparam name="TImplementation">Dependency resolution</typeparam>
/// <param name="resolveName">Dependency name</param>
/// <param name="shared">true - for singletone</param>
/// <param name="fallback">Error handler</param>
/// <returns>true - registration successfully completed</returns>
7 months ago
bool TryRegister<TContract, TImplementation>(string resolveName, bool shared, Action<Exception> fallback = null!);
6 years ago
/// <summary>
/// Safe dependency resolution registration
6 years ago
/// </summary>
/// <param name="contractType">Contract</param>
/// <param name="implementationType">Dependency resolution</param>
/// <param name="fallback">Error handler</param>
/// <returns>true - registration successfully completed</returns>
7 months ago
bool TryRegister(Type contractType, Type implementationType, Action<Exception> fallback = null!);
6 years ago
/// <summary>
/// Safe dependency resolution registration
6 years ago
/// </summary>
/// <param name="contractType">Contract</param>
/// <param name="implementationType">Dependency resolution</param>
/// <param name="resolveName">Dependency name</param>
/// <param name="fallback">Error handler</param>
/// <returns>true - registration successfully completed</returns>
7 months ago
bool TryRegister(Type contractType, Type implementationType, string resolveName, Action<Exception> fallback = null!);
6 years ago
/// <summary>
/// Safe dependency resolution registration
6 years ago
/// </summary>
/// <param name="contractType">Contract</param>
/// <param name="implementationType">Dependency resolution</param>
/// <param name="shared">true - for singletone</param>
/// <param name="fallback">Error handler</param>
/// <returns>true - registration successfully completed</returns>
7 months ago
bool TryRegister(Type contractType, Type implementationType, bool shared, Action<Exception> fallback = null!);
6 years ago
/// <summary>
/// Safe dependency resolution registration
6 years ago
/// </summary>
/// <param name="contractType">Contract</param>
/// <param name="implementationType">Dependency resolution</param>
/// <param name="resolveName">Dependency name</param>
/// <param name="shared">true - for singletone</param>
/// <param name="fallback">Error handler</param>
/// <returns>true - registration successfully completed</returns>
7 months ago
bool TryRegister(Type contractType, Type implementationType, string resolveName, bool shared, Action<Exception> fallback = null!);
#endregion Safe register
6 years ago
#region Safe register with parameters
6 years ago
/// <summary>
/// Safe dependency resolution registration with constructor parameters
6 years ago
/// </summary>
/// <typeparam name="TContract">Contract</typeparam>
/// <typeparam name="TImplementation">Dependency resolution</typeparam>
/// <param name="constructorParameters">Ctor args</param>
/// <param name="fallback">Error handler</param>
/// <returns>true - registration successfully completed</returns>
7 months ago
bool TryParameterizedRegister<TContract, TImplementation>(object[] constructorParameters, Action<Exception> fallback = null!);
6 years ago
/// <summary>
/// Safe dependency resolution registration with constructor parameters
6 years ago
/// </summary>
/// <typeparam name="TContract">Contract</typeparam>
/// <typeparam name="TImplementation">Dependency resolution</typeparam>
/// <param name="resolveName">Dependency name</param>
/// <param name="constructorParameters">Ctor args</param>
/// <param name="fallback">Error handler</param>
/// <returns>true - registration successfully completed</returns>
7 months ago
bool TryParameterizedRegister<TContract, TImplementation>(string resolveName, object[] constructorParameters, Action<Exception> fallback = null!);
6 years ago
/// <summary>
/// Safe dependency resolution registration with constructor parameters
6 years ago
/// </summary>
/// <typeparam name="TContract">Contract</typeparam>
/// <typeparam name="TImplementation">Dependency resolution</typeparam>
/// <param name="shared">true - for singletone</param>
/// <param name="constructorParameters">Ctor args</param>
/// <param name="fallback">Error handler</param>
/// <returns>true - registration successfully completed</returns>
7 months ago
bool TryParameterizedRegister<TContract, TImplementation>(bool shared, object[] constructorParameters, Action<Exception> fallback = null!);
6 years ago
/// <summary>
/// Safe dependency resolution registration with constructor parameters
6 years ago
/// </summary>
/// <typeparam name="TContract">Contract</typeparam>
/// <typeparam name="TImplementation">Dependency resolution</typeparam>
/// <param name="resolveName">Dependency name</param>
/// <param name="shared">true - for singletone</param>
/// <param name="constructorParameters">Ctor args</param>
/// <param name="fallback">Error handler</param>
/// <returns>true - registration successfully completed</returns>
7 months ago
bool TryParameterizedRegister<TContract, TImplementation>(string resolveName, bool shared, object[] constructorParameters, Action<Exception> fallback = null!);
6 years ago
/// <summary>
/// Safe dependency resolution registration with constructor parameters
6 years ago
/// </summary>
/// <param name="contractType">Contract</param>
/// <param name="implementationType">Dependency resolution</param>
/// <param name="constructorParameters">Ctor args</param>
/// <param name="fallback">Error handler</param>
/// <returns>true - registration successfully completed</returns>
7 months ago
bool TryParameterizedRegister(Type contractType, Type implementationType, object[] constructorParameters, Action<Exception> fallback = null!);
6 years ago
/// <summary>
/// Safe dependency resolution registration with constructor parameters
6 years ago
/// </summary>
/// <param name="contractType">Contract</param>
/// <param name="implementationType">Dependency resolution</param>
/// <param name="resolveName">Dependency name</param>
/// <param name="constructorParameters">Ctor args</param>
/// <param name="fallback">Error handler</param>
/// <returns>true - registration successfully completed</returns>
7 months ago
bool TryParameterizedRegister(Type contractType, Type implementationType, string resolveName, object[] constructorParameters, Action<Exception> fallback = null!);
6 years ago
/// <summary>
/// Safe dependency resolution registration with constructor parameters
6 years ago
/// </summary>
/// <param name="contractType">Contract</param>
/// <param name="implementationType">Dependency resolution</param>
/// <param name="shared">true - for singletone</param>
/// <param name="constructorParameters">Ctor args</param>
/// <param name="fallback">Error handler</param>
/// <returns>true - registration successfully completed</returns>
7 months ago
bool TryParameterizedRegister(Type contractType, Type implementationType, bool shared, object[] constructorParameters, Action<Exception> fallback = null!);
6 years ago
/// <summary>
/// Safe dependency resolution registration with constructor parameters
6 years ago
/// </summary>
/// <param name="contractType">Contract</param>
/// <param name="implementationType">Dependency resolution</param>
/// <param name="resolveName">Dependency name</param>
/// <param name="shared">true - for singletone</param>
/// <param name="constructorParameters">Ctor args</param>
/// <param name="fallback">Error handler</param>
/// <returns>true - registration successfully completed</returns>
7 months ago
bool TryParameterizedRegister(Type contractType, Type implementationType, string resolveName, bool shared, object[] constructorParameters, Action<Exception> fallback = null!);
#endregion Safe register with parameters
6 years ago
}
}

Powered by TurnKey Linux.