public static void ToAssembly <T>(this IBindContext <T> self, Assembly assembly, Action <IScopeContext> scopeHandler = null)
 {
     foreach (var definedType in assembly.DefinedTypes)
     {
         if (!definedType.Implements(typeof(T)))
         {
             continue;
         }
         var           attrib = definedType.GetAttribute <ImplementationKeyAttribute>();
         IScopeContext scope;
         if (attrib != null)
         {
             scope = self.To(definedType, attrib.Name);
         }
         else
         {
             scope = self.To(definedType);
         }
         if (scopeHandler != null)
         {
             scopeHandler(scope);
         }
     }
 }
Esempio n. 2
0
 public IScopeContext To <TService>() where TService : T
 {
     ServiceFactory.CreateServiceImplementation <T>(new ServiceLocator(_resolver));
     BlueprintExtensions.HasRegisteredServices = true;
     return(_bind.To <TService>());
 }