19 using System.Collections.Generic;
33 public static TService ResolveService<TService>(
this IContext context,
object serviceKey) {
34 return context.Scope.Resolve<TService>(serviceKey);
37 public static TService ResolveService<TService>(
this IContext context) {
38 return context.Scope.Resolve<TService>();
45 public static IEnumerable<TService> ResolveAllServices<TService>(
this IContext context) {
46 return context.Scope.ResolveAll<TService>();
50 context.
Scope.
Register(serviceType, implementationType, serviceKey);
65 public static void RegisterService<TService, TImplementation>(
this IContext context,
object serviceKey)
66 where TImplementation :
class, TService {
67 context.Scope.Register<TService, TImplementation>(serviceKey);
70 public static void RegisterService<TService, TImplementation>(
this IContext context)
71 where TImplementation :
class, TService {
72 context.Scope.Register<TService, TImplementation>();
75 public static void RegisterService<TService>(
this IContext context,
object serviceKey)
76 where TService :
class {
77 context.Scope.Register<TService>(serviceKey);
80 public static void RegisterService<TService>(
this IContext context)
81 where TService :
class {
82 context.Scope.Register<TService>();
86 context.
Scope.RegisterInstance(serviceType, instance, serviceKey);
90 context.
Scope.RegisterInstance(serviceType, instance);
93 public static void RegisterInstance<TService>(
this IContext context, TService instance,
object serviceKey)
94 where TService :
class {
95 context.Scope.RegisterInstance<TService>(instance, serviceKey);
98 public static void RegisterInstance<TService>(
this IContext context, TService instance)
99 where TService :
class {
100 context.Scope.RegisterInstance<TService>(instance);
107 public static void UnregisterService<TService>(
this IContext context,
object serviceKey) {
108 context.Scope.Unregister<TService>(serviceKey);
111 public static void UnregisterService<TService>(
this IContext context) {
112 context.Scope.Unregister<TService>();
static object ResolveService(this IContext context, Type serviceType)
static IEnumerable ResolveAllServices(this IContext context, Type serviceType)
static object ResolveService(this IContext context, Type serviceType, object serviceKey)
bool Unregister(Type serviceType, object serviceKey)
static void RegisterInstance(this IContext context, Type serviceType, object instance, object serviceKey)
static void RegisterService(this IContext context, Type serviceType, Type implementationType, object serviceKey)
static void UnregisterService(this IContext context, Type serviceType)
static void RegisterService(this IContext context, Type serviceType, Type implementationType)
object Resolve(Type serviceType, object serviceKey)
IEnumerable ResolveAll(Type serviceType)
static void RegisterService(this IContext context, Type serviceType, object serviceKey)
static void RegisterInstance(this IContext context, Type serviceType, object instance)
void Register(ServiceRegistration registration)
static void RegisterService(this IContext context, Type serviceType)