Пример #1
0
 /// <param name="serviceMap">The ServiceMap configured at startup the contains the registered controllers and action methods</param>
 /// <param name="serviceProvider">The service provider LittleTushy was added to that can be used to resolve ServiceController isntances with at runtime</param>
 public LittleTushyServer(
     ServiceMap serviceMap,
     IServiceProvider serviceProvider
     )
 {
     this.serviceMap      = serviceMap;
     this.serviceProvider = serviceProvider;
 }
Пример #2
0
        /// <summary>
        /// Find the the ServiceControllers and register them and add their methods to the service map
        /// </summary>
        private static void MapControllers(IServiceCollection serviceCollection, Assembly assembly)
        {
            var servicesTemp  = new Dictionary <string, ServiceControllerDefinition>();
            var assemblyTypes = assembly.GetTypes();

            foreach (var type in assemblyTypes)
            {
                MapType(serviceCollection, servicesTemp, type);
            }

            var serviceMap = new ServiceMap(servicesTemp);

            serviceCollection.AddSingleton(serviceMap);
        }