Example #1
0
        static void AddStoreServices(IServiceCollection services, TypeFinder typeFinder, params Assembly[] assemblies)
        {
            var serviceType = typeof(IStoreService);

            foreach (var implementationType in typeFinder.GetTypesBySpecifiedType(serviceType, assemblies))
            {
                services.TryAddEnumerable(ServiceDescriptor.Singleton(serviceType, implementationType));
            }
        }
Example #2
0
 static void AddEventHandlers(IServiceCollection services, TypeFinder typeFinder, params Assembly[] assemblies)
 {
     foreach (var implementationType in typeFinder.GetTypesBySpecifiedType(typeof(IEventHandler <>), assemblies))
     {
         foreach (var serviceType in implementationType.GetTypeInfo().ImplementedInterfaces)
         {
             services.TryAddEnumerable(ServiceDescriptor.Scoped(serviceType, implementationType));
         }
     }
 }