示例#1
0
        public static void AddStubMiddlewareWithDefaults(this IServiceCollection services)
        {
            var stubMiddlewareOptions = new StubMiddlewareOptions();

            services.AddSingleton <StubManagerOptions>(stubMiddlewareOptions);
            services.AddSingleton <IConventionMappingProfile, DefaultConventionMappingProfile>();
            services.AddSingleton <IStubTypeCacheKeyGenerator, DefaultStubTypeCacheKeyGenerator>();
            services.AddSingleton <IStubTypeCache, MemoryStubTypeCache>();
            services.AddSingleton <IStubManager, StubManager>();
        }
示例#2
0
 public static void AddStubMiddleware <TStubDataMappingProfile, TStubTypeCacheKeyGenerator>(this IServiceCollection services, StubMiddlewareOptions stubMiddlewareOptions)
     where TStubDataMappingProfile : class, IConventionMappingProfile
     where TStubTypeCacheKeyGenerator : class, IStubTypeCacheKeyGenerator
 {
     services.AddSingleton <StubManagerOptions>(stubMiddlewareOptions);
     services.AddSingleton <IConventionMappingProfile, TStubDataMappingProfile>();
     services.AddSingleton <IStubTypeCacheKeyGenerator, TStubTypeCacheKeyGenerator>();
     services.AddSingleton <IStubTypeCache, MemoryStubTypeCache>();
     services.AddSingleton <IStubManager, StubManager>();
 }