using System;
namespace Tapeti
{
///
/// Wrapper interface for an IoC container to allow dependency injection in Tapeti.
///
public interface IDependencyResolver
{
///
/// Resolve an instance of T
///
/// The type to instantiate
/// A new or singleton instance, depending on the registration
T Resolve() where T : class;
///
/// Resolve an instance of T
///
/// The type to instantiate
/// A new or singleton instance, depending on the registration
object Resolve(Type type);
}
///
/// Allows registering controller classes into the IoC container. Also registers default implementations,
/// so that the calling application may override these.
///
///
/// All implementations of IDependencyResolver should implement IDependencyContainer as well,
/// otherwise all registrations of Tapeti components will have to be done manually by the application.
///
public interface IDependencyContainer : IDependencyResolver
{
///
/// Registers a default implementation in the IoC container. If an alternative implementation
/// was registered before, it is not replaced.
///
///
///
void RegisterDefault() where TService : class where TImplementation : class, TService;
///
/// Registers a default implementation in the IoC container. If an alternative implementation
/// was registered before, it is not replaced.
///
///
///
void RegisterDefault(Func factory) where TService : class;
///
/// Registers a default singleton implementation in the IoC container. If an alternative implementation
/// was registered before, it is not replaced.
///
///
///
void RegisterDefaultSingleton() where TService : class where TImplementation : class, TService;
///
/// Registers a default singleton implementation in the IoC container. If an alternative implementation
/// was registered before, it is not replaced.
///
///
///
void RegisterDefaultSingleton(TService instance) where TService : class;
///
/// Registers a default singleton implementation in the IoC container. If an alternative implementation
/// was registered before, it is not replaced.
///
///
///
void RegisterDefaultSingleton(Func factory) where TService : class;
///
/// Registers a concrete controller class in the IoC container.
///
///
void RegisterController(Type type);
}
}