// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { Log.Logger = _loggerBuilder.Logger(); AddControllers(services); IdentityModelEventSource.ShowPII = true; services .AddDbContextPool <DatabaseContext>(options => options.UseNpgsql(Configuration.GetConnectionString("DefaultConnection"))); services.AddIdentityServerSettings(Configuration); services .AddGoogleAuth(Configuration) .AddApplicationServices(Configuration); services.AddCors(options => { options.AddPolicy(CorsPolicyName, builder => builder .AllowAnyOrigin() .AllowAnyMethod() .AllowAnyHeader()); }); services.AddAutoMapper(CoreMappings.GetAssembly()); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { Log.Logger = _loggerBuilder.Logger(); services.AddControllers().AddNewtonsoftJson(o => { o.SerializerSettings.ReferenceLoopHandling = ReferenceLoopHandling.Ignore; }); services .AddDbContextPool <DatabaseContext>(options => options .UseNpgsql(Configuration.GetConnectionString("DefaultConnection"))); services.AddCors(options => { options.AddPolicy(CorsPolicyName, builder => builder .AllowAnyOrigin() .AllowAnyMethod() .AllowAnyHeader()); }); // Register the Swagger generator, defining 1 or more Swagger documents services.AddSwaggerGen(SwaggerConfig.SwaggerGenConfig); services .AddAutoMapper(CoreMappings.GetAssembly()) .AddJwtAuth(Configuration) .AddClaimPolicies() .AddServices(Configuration) .AddCoravelScheduler(); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { Log.Logger = _loggerBuilder.Logger(); services.AddControllers().AddNewtonsoftJson(o => { o.SerializerSettings.ReferenceLoopHandling = ReferenceLoopHandling.Ignore; }); DatabaseConfig.Setup(services, Configuration, Environment); services.AddCors(options => { options.AddPolicy(CorsPolicyName, builder => builder .AllowAnyOrigin() .AllowAnyMethod() .AllowAnyHeader()); }); // Register the Swagger generator, defining 1 or more Swagger documents services.AddSwaggerGen(SwaggerConfig.SwaggerGenConfig); services .AddAutoMapper(CoreMappings.GetAssembly()) .AddJwtAuth(Configuration) .AddClaimPolicies() .AddServices(Configuration, Environment) .AddCoravelScheduler() .HealthCheck(Configuration) .SetupMassTransit( hostString: new NonNullableString( value: Configuration.GetSection("MessageBroker")["RabbitHost"], paramName: "(\"MessageBroker\")[\"RabbitHost\"]")); }
public void CoreMappings_Generates_Correct_NHibernate_Mapping_Xml() { if(!Directory.Exists(MappingFileOutputPath)) { Directory.CreateDirectory(MappingFileOutputPath); } if (!Directory.Exists(MappingBaselinePath)) { Directory.CreateDirectory(MappingBaselinePath); } // Arrange MappingConfiguration configuration = new MappingConfiguration(); CoreMappings mappings = new CoreMappings(); mappings.ContributeMappings(configuration); configuration.FluentMappings.ExportTo(MappingFileOutputPath); // Act // NOTE: Exceptions should only occur AFTER export, since Configuration only occurs after export. // NOTE: So, any unhandled exceptions here should simply be suppressed. try { configuration.Apply(null); } catch(ApplicationException) {} // All the exceptions we want to suppress are wrapped in ApplicationExceptions // Assert #if !GENERATE_BASELINES foreach(string fullResourceName in Assembly.GetExecutingAssembly().GetManifestResourceNames()) { if(fullResourceName.StartsWith(MappingBaselineResourceNamespace)) { string asmRelativeName = fullResourceName.Substring(MappingBaselineResourceAssembly.Length); string folderRelativeName = fullResourceName.Substring(MappingBaselineResourceNamespace.Length); TestFileManager.ExtractTestFile(asmRelativeName, Path.Combine(MappingBaselinePath, folderRelativeName)); } } TestFileManager.CompareFilesAgainstBaseline(MappingFileOutputPath, MappingBaselinePath, "*.hbm.xml", (e, a) => { FileAssert.TextFilesAreEqual(e, a, TokenTransformer, "The mapping files did not match"); }); Directory.Delete(TestFilesPath, true); #else foreach (string file in Directory.GetFiles(MappingFileOutputPath, "*.hbm.xml")) { File.Copy(file, Path.Combine(MappingBaselinePath, Path.GetFileName(file))); } #endif }
public static void Initialize() { Initialize(CoreMappings.GetProfiles()); }