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

144 lines
5.3 KiB

6 years ago
using System;
namespace ZeroLevel.Patterns.DependencyInjection
{
/// <summary>
/// Dependency resolver
6 years ago
/// </summary>
public interface IResolver
{
#region Activator
6 years ago
/// <summary>
/// Creating an instance of an object of the specified type
6 years ago
/// </summary>
/// <typeparam name="T">Contract or instance type</typeparam>
/// <param name="resolveName">Dependency name</param>
/// <returns>Instance</returns>
6 years ago
T CreateInstance<T>(string resolveName = "");
6 years ago
/// <summary>
/// Creating an instance of an object of the specified type
6 years ago
/// </summary>
/// <typeparam name="T">Contract or instance type</typeparam>
/// <param name="args">Ctor agrs</param>
/// <param name="resolveName">Dependency name</param>
/// <returns>Instance</returns>
6 years ago
T CreateInstance<T>(object[] args, string resolveName = "");
6 years ago
/// <summary>
/// Creating an instance of an object of the specified type
6 years ago
/// </summary>
/// <param name="type">Contract or instance type</param>
/// <param name="resolveName">Dependency name</param>
/// <returns>Instance</returns>
6 years ago
object CreateInstance(Type type, string resolveName = "");
6 years ago
/// <summary>
/// Creating an instance of an object of the specified type
6 years ago
/// </summary>
/// <param name="type">Contract or instance type</param>
/// <param name="args">Ctor agrs</param>
/// <param name="resolveName">Dependency name</param>
/// <returns>Instance</returns>
6 years ago
object CreateInstance(Type type, object[] args, string resolveName = "");
#endregion Activator
6 years ago
#region Resolving
6 years ago
/// <summary>
/// Dependency resolve
6 years ago
/// </summary>
/// <typeparam name="T">Contract</typeparam>
/// <param name="compose">Compose the object when true</param>
/// <returns>Instance</returns>
6 years ago
T Resolve<T>(bool compose = true);
6 years ago
/// <summary>
/// Dependency resolve
6 years ago
/// </summary>
/// <typeparam name="T">Contract</typeparam>
/// <param name="resolveName">Dependency name</param>
/// <param name="compose">Compose the object when true</param>
/// <returns>Instance</returns>
6 years ago
T Resolve<T>(string resolveName, bool compose = true);
6 years ago
/// <summary>
/// Dependency resolve
6 years ago
/// </summary>
/// <typeparam name="T">Contract</typeparam>
/// <param name="args">Ctor agrs</param>
/// <param name="compose">Compose the object when true</param>
/// <returns>Instance</returns>
6 years ago
T Resolve<T>(object[] args, bool compose = true);
6 years ago
/// <summary>
/// Dependency resolve
6 years ago
/// </summary>
/// <typeparam name="T">Contract</typeparam>
/// <param name="resolveName">Dependency name</param>
/// <param name="args">Ctor agrs</param>
/// <param name="compose">Compose the object when true</param>
/// <returns>Instance</returns>
6 years ago
T Resolve<T>(string resolveName, object[] args, bool compose = true);
6 years ago
/// <summary>
/// Dependency resolve
6 years ago
/// </summary>
/// <param name="type">Contract</param>
/// <param name="compose">Compose the object when true</param>
/// <returns>Instance</returns>
6 years ago
object Resolve(Type type, bool compose = true);
6 years ago
/// <summary>
/// Dependency resolve
6 years ago
/// </summary>
/// <param name="type">Contract</param>
/// <param name="resolveName">Dependency name</param>
/// <param name="compose">Compose the object when true</param>
/// <returns>Instance</returns>
6 years ago
object Resolve(Type type, string resolveName, bool compose = true);
6 years ago
/// <summary>
/// Dependency resolve
6 years ago
/// </summary>
/// <param name="type">Contract</param>
/// <param name="args">Ctor agrs</param>
/// <param name="compose">Compose the object when true</param>
/// <returns>Instance</returns>
6 years ago
object Resolve(Type type, object[] args, bool compose = true);
6 years ago
/// <summary>
/// Dependency resolve
6 years ago
/// </summary>
/// <param name="type">Contract</param>
/// <param name="resolveName">Dependency name</param>
/// <param name="args">Ctor agrs</param>
/// <param name="compose">Compose the object when true</param>
/// <returns>Instance</returns>
6 years ago
object Resolve(Type type, string resolveName, object[] args, bool compose = true);
#endregion Resolving
6 years ago
#region Safe resolving
6 years ago
object TryResolve(Type type, out object result, bool compose = true);
6 years ago
object TryResolve(Type type, object[] args, out object result, bool compose = true);
6 years ago
object TryResolve(Type type, string resolveName, out object result, bool compose = true);
6 years ago
bool TryResolve<T>(out T result, bool compose = true);
6 years ago
bool TryResolve<T>(object[] args, out T result, bool compose = true);
6 years ago
bool TryResolve<T>(string resolveName, out T result, bool compose = true);
6 years ago
bool TryResolve<T>(string resolveName, object[] args, out T result, bool compose = true);
6 years ago
bool TryResolve(Type type, string resolveName, object[] args, out object result, bool compose = true);
#endregion Safe resolving
6 years ago
}
}

Powered by TurnKey Linux.