示例#1
0
        public void ConfigureServices(IServiceCollection services)
        {
            var settings = new JsonSerializerSettings();

            settings.ContractResolver = new SignalRContractResolver();

            var serializer = JsonSerializer.Create(settings);

            services.Add(new ServiceDescriptor(typeof(JsonSerializer),
                                               provider => serializer,
                                               ServiceLifetime.Transient));

            services.AddSignalR(options => options.Hubs.EnableDetailedErrors = true);
            services.AddMvc();
            services.AddTransient <IBuildRepository>(s => Mockers.MockIBuildRepository());
            services.AddSingleton <IBuildMonitorService>(s => Mockers.MockIBuildMonitorService());
        }