コード例 #1
0
 private void RegisterCommandHandlers(ContainerBuilder builder)
 {
     foreach (var type in _classLocator.Implements <ICommandHandler>())
     {
         if (ClassLocator.Implements <ISingleton>(type))
         {
             Trace($"register command handler: {type.Name} -> ImplementedInterfaces, SingleInstance");
             builder.RegisterType(type).AsImplementedInterfaces().SingleInstance();
         }
         else
         {
             Trace($"register command handler: {type.Name} -> ImplementedInterfaces, InstancePerDependency");
             builder.RegisterType(type).AsImplementedInterfaces().InstancePerDependency();
         }
     }
 }
コード例 #2
0
 public IEnumerable <Type> FindTypesImplementing <T>()
 {
     return(_finder.Implements <T>());
 }