public SingularityController(ICommandService commandService, IQueryService queryService, ILogger logger, ApiClientRegistrations apiClientRegistrations)
 {
     _commandService         = commandService;
     _queryService           = queryService;
     _logger                 = logger;
     _apiClientRegistrations = apiClientRegistrations;
 }
예제 #2
0
        private void LoadApiClientRegistrations(AutofacContainerBuilder builder, List <Assembly> assemblies)
        {
            var registrations = new ApiClientRegistrations();

            foreach (var assembly in assemblies)
            {
                foreach (var type in assembly.GetTypes())
                {
                    var api = (EnableApiAttribute)type.GetCustomAttribute(typeof(EnableApiAttribute));

                    if (api == null)
                    {
                        continue;
                    }
                    registrations.Add(new ApiClientRegistration {
                        Route = api.Route, Type = type
                    });
                }
            }

            builder.RegisterInstance(registrations);
        }