Ejemplo n.º 1
0
        public static void Register(this BusRegistrar registrar, Assembly assembly)
        {
            var allHandlers = assembly.GetTypes()
                              .Where(t =>
            {
                var interfaces = t.GetInterfaces();

                return
                (interfaces.Any(y => y.GetTypeInfo().IsGenericType&& y.GetTypeInfo().GetGenericTypeDefinition() == typeof(ICancellableHandler <>)) ||
                 interfaces.Any(y => y.GetTypeInfo().IsGenericType&& y.GetTypeInfo().GetGenericTypeDefinition() == typeof(IHandler <>)));
            });

            if (allHandlers.Any())
            {
                registrar.Register(allHandlers.First());
            }
        }
Ejemplo n.º 2
0
 public static void RegisterEntryAssembly(this BusRegistrar registrar)
 {
     registrar.Register(Assembly.GetEntryAssembly());
 }