예제 #1
0
        public void RegisterServices(IServiceCollection services)
        {
            DataServiceRegistration.Register(services);

            services
            .AddSingleton(InputParserOptions.Default)
            .AddSingleton <Action <IServiceProvider, IModuleFactory> >((serviceProvider, moduleFactory) =>
            {
                var serviceCollector = TypeCollector.Create(type => type.IsInterface && type != typeof(IModule));
                var services         = serviceCollector.Collect <IModule>(definitions => definitions.DescribeAssembly <IModuleFactory>());
                foreach (var service in services)
                {
                    moduleFactory.Add(service.Name, (IModule)serviceProvider.GetRequiredService(service));
                }
            })
            .AddSingleton(UtilityCommands.GetCommands()
                          .Union(ManagementCommands.GetCommands())
                          .Union(LoginCommands.GetCommands()))
            .AddSingleton <IApplicationSettings, ApplicationSettings>()
            .AddSingleton(typeof(IConsoleWrapper <>), typeof(ConsoleWrapper <>))
            .RegisterCacheState <DateTimeOffset>()
            .RegisterServices(BuildSecurityProfiles,
                              configureDistrubutedCacheOptions: ConfigureDistrubutedCacheOptions,
                              configureDistributedCacheEntryOptions: ConfigureDistributedCacheEntryOptions,
                              scannerConfiguration: scanner => scanner
                              .FromAssemblyOf <ServiceRegistration>()
                              .AddClasses(filter => filter.WithoutAttribute <IgnoreScanningAttribute>())
                              .AsMatchingInterface());
        }
예제 #2
0
        public AnalyticsClient(Authentication auth, AnalyticsAccount account) :
            base(auth)
        {
            this.RestClients = new AnalyticsRestClients(account, auth);

            this.Jobs       = new JobCommands(account, this.RestClients);
            this.Catalog    = new CatalogCommands(account, this.RestClients);
            this.Management = new ManagementCommands(account, this.RestClients);
        }