DeveelDB  20151217
complete SQL database system, primarly developed for .NET/Mono frameworks
Static Public Member Functions | List of all members
Deveel.Data.Services.ScopeExtensions Class Reference

Static Public Member Functions

static object Resolve (this IScope scope, Type serviceType)
 
static TService Resolve< TService > (this IScope scope, object serviceKey)
 
static TService Resolve< TService > (this IScope scope)
 
static IEnumerable< TService > ResolveAll< TService > (this IScope scope)
 
static void Register (this IScope scope, Type serviceType, Type implementationType, object serviceKey)
 
static void Register (this IScope scope, Type serviceType)
 
static void Register (this IScope scope, Type serviceType, object serviceKey)
 
static void Register< TService, TImplementation > (this IScope scope, object serviceKey)
 
static void Register< TService, TImplementation > (this IScope scope)
 
static void Register< TService > (this IScope scope, object serviceKey)
 
static void Register< TService > (this IScope scope)
 
static void RegisterInstance (this IScope scope, Type serviceType, object instance)
 
static void RegisterInstance (this IScope scope, Type serviceType, object instance, object serviceKey)
 
static void RegisterInstance< TService > (this IScope scope, TService instance)
 
static void RegisterInstance< TService > (this IScope scope, TService instance, object serviceKey)
 
static bool Unregister (this IScope scope, Type serviceType)
 
static bool Unregister< TService > (this IScope scope, object serviceKey)
 
static bool Unregister< TService > (this IScope scope)
 
static void Replace (this IScope scope, Type serviceType, Type implementationType)
 
static void Replace (this IScope scope, Type serviceType, Type implementationType, object serviceKey)
 
static void Replace< TService, TImplementation > (this IScope scope)
 
static void Replace< TService, TImplementation > (this IScope scope, object serviceKey)
 

Detailed Description

Definition at line 23 of file ScopeExtensions.cs.

Member Function Documentation

static void Deveel.Data.Services.ScopeExtensions.Register ( this IScope  scope,
Type  serviceType,
Type  implementationType,
object  serviceKey 
)
inlinestatic

Definition at line 40 of file ScopeExtensions.cs.

40  {
41  var registration = new ServiceRegistration(serviceType, implementationType);
42  registration.ServiceKey = serviceKey;
43  scope.Register(registration);
44  }
static void Deveel.Data.Services.ScopeExtensions.Register ( this IScope  scope,
Type  serviceType 
)
inlinestatic

Definition at line 46 of file ScopeExtensions.cs.

46  {
47  Register(scope, serviceType, null);
48  }
static void Register(this IScope scope, Type serviceType, Type implementationType, object serviceKey)
static void Deveel.Data.Services.ScopeExtensions.Register ( this IScope  scope,
Type  serviceType,
object  serviceKey 
)
inlinestatic

Definition at line 50 of file ScopeExtensions.cs.

50  {
51  if (serviceType == null)
52  throw new ArgumentNullException("serviceType");
53 
54  if (!serviceType.IsClass)
55  throw new ArgumentException(String.Format("The service type '{0}' to register is not a class.", serviceType));
56 
57  var interfaces = serviceType.GetInterfaces();
58  foreach (var interfaceType in interfaces) {
59  scope.Register(interfaceType, serviceType, serviceKey);
60  }
61 
62  scope.Register(serviceType, serviceType, serviceKey);
63  }
A long string in the system.
static void Deveel.Data.Services.ScopeExtensions.Register< TService > ( this IScope  scope,
object  serviceKey 
)
inlinestatic
Type Constraints
TService :class 

Definition at line 75 of file ScopeExtensions.cs.

76  : class {
77  scope.Register(typeof(TService), serviceKey);
78  }
static void Deveel.Data.Services.ScopeExtensions.Register< TService > ( this IScope  scope)
inlinestatic
Type Constraints
TService :class 

Definition at line 80 of file ScopeExtensions.cs.

81  : class {
82  scope.Register<TService>(null);
83  }
static void Deveel.Data.Services.ScopeExtensions.Register< TService, TImplementation > ( this IScope  scope,
object  serviceKey 
)
inlinestatic
Type Constraints
TImplementation :class 
TImplementation :TService 

Definition at line 65 of file ScopeExtensions.cs.

66  : class, TService {
67  scope.Register(typeof(TService), typeof(TImplementation), serviceKey);
68  }
static void Deveel.Data.Services.ScopeExtensions.Register< TService, TImplementation > ( this IScope  scope)
inlinestatic
Type Constraints
TImplementation :class 
TImplementation :TService 

Definition at line 70 of file ScopeExtensions.cs.

71  : class, TService {
72  scope.Register<TService, TImplementation>(null);
73  }
static void Deveel.Data.Services.ScopeExtensions.RegisterInstance ( this IScope  scope,
Type  serviceType,
object  instance 
)
inlinestatic

Definition at line 85 of file ScopeExtensions.cs.

85  {
86  RegisterInstance(scope, serviceType, instance, null);
87  }
static void RegisterInstance(this IScope scope, Type serviceType, object instance)
static void Deveel.Data.Services.ScopeExtensions.RegisterInstance ( this IScope  scope,
Type  serviceType,
object  instance,
object  serviceKey 
)
inlinestatic

Definition at line 89 of file ScopeExtensions.cs.

89  {
90  if (serviceType == null)
91  throw new ArgumentNullException("serviceType");
92  if (instance == null)
93  throw new ArgumentNullException("instance");
94 
95  var implementationType = instance.GetType();
96  var registration = new ServiceRegistration(serviceType, implementationType);
97  registration.Instance = instance;
98  registration.ServiceKey = serviceKey;
99  scope.Register(registration);
100  }
static void Deveel.Data.Services.ScopeExtensions.RegisterInstance< TService > ( this IScope  scope,
TService  instance 
)
inlinestatic
Type Constraints
TService :class 

Definition at line 102 of file ScopeExtensions.cs.

102  : class {
103  RegisterInstance(scope, instance, null);
104  }
static void RegisterInstance(this IScope scope, Type serviceType, object instance)
static void Deveel.Data.Services.ScopeExtensions.RegisterInstance< TService > ( this IScope  scope,
TService  instance,
object  serviceKey 
)
inlinestatic
Type Constraints
TService :class 

Definition at line 106 of file ScopeExtensions.cs.

106  : class {
107  var interfaces = typeof (TService).GetInterfaces();
108  foreach (var interfaceType in interfaces) {
109  scope.RegisterInstance(interfaceType, instance, serviceKey);
110  }
111 
112  scope.RegisterInstance(typeof(TService), instance, serviceKey);
113  }
static void Deveel.Data.Services.ScopeExtensions.Replace ( this IScope  scope,
Type  serviceType,
Type  implementationType 
)
inlinestatic

Definition at line 127 of file ScopeExtensions.cs.

127  {
128  scope.Replace(serviceType, implementationType, null);
129  }
static void Deveel.Data.Services.ScopeExtensions.Replace ( this IScope  scope,
Type  serviceType,
Type  implementationType,
object  serviceKey 
)
inlinestatic

Definition at line 131 of file ScopeExtensions.cs.

131  {
132  if (scope.Unregister(serviceType, serviceKey))
133  scope.Register(serviceType, implementationType, serviceKey);
134  }
static void Deveel.Data.Services.ScopeExtensions.Replace< TService, TImplementation > ( this IScope  scope)
inlinestatic
Type Constraints
TImplementation :class 
TImplementation :TService 

Definition at line 136 of file ScopeExtensions.cs.

137  : class, TService {
138  scope.Replace<TService, TImplementation>(null);
139  }
static void Deveel.Data.Services.ScopeExtensions.Replace< TService, TImplementation > ( this IScope  scope,
object  serviceKey 
)
inlinestatic
Type Constraints
TImplementation :class 
TImplementation :TService 

Definition at line 141 of file ScopeExtensions.cs.

142  : class, TService {
143  scope.Replace(typeof(TService), typeof(TImplementation), serviceKey);
144  }
static object Deveel.Data.Services.ScopeExtensions.Resolve ( this IScope  scope,
Type  serviceType 
)
inlinestatic

Definition at line 24 of file ScopeExtensions.cs.

24  {
25  return scope.Resolve(serviceType, null);
26  }
static TService Deveel.Data.Services.ScopeExtensions.Resolve< TService > ( this IScope  scope,
object  serviceKey 
)
inlinestatic

Definition at line 28 of file ScopeExtensions.cs.

28  {
29  return (TService) scope.Resolve(typeof(TService), serviceKey);
30  }
static TService Deveel.Data.Services.ScopeExtensions.Resolve< TService > ( this IScope  scope)
inlinestatic

Definition at line 32 of file ScopeExtensions.cs.

32  {
33  return scope.Resolve<TService>(null);
34  }
static IEnumerable<TService> Deveel.Data.Services.ScopeExtensions.ResolveAll< TService > ( this IScope  scope)
inlinestatic

Definition at line 36 of file ScopeExtensions.cs.

36  {
37  return scope.ResolveAll(typeof (TService)).Cast<TService>();
38  }
static bool Deveel.Data.Services.ScopeExtensions.Unregister ( this IScope  scope,
Type  serviceType 
)
inlinestatic

Definition at line 115 of file ScopeExtensions.cs.

115  {
116  return scope.Unregister(serviceType, null);
117  }
static bool Deveel.Data.Services.ScopeExtensions.Unregister< TService > ( this IScope  scope,
object  serviceKey 
)
inlinestatic

Definition at line 119 of file ScopeExtensions.cs.

119  {
120  return scope.Unregister(typeof (TService), serviceKey);
121  }
static bool Deveel.Data.Services.ScopeExtensions.Unregister< TService > ( this IScope  scope)
inlinestatic

Definition at line 123 of file ScopeExtensions.cs.

123  {
124  return scope.Unregister<TService>(null);
125  }

The documentation for this class was generated from the following file: