if (isPostGres)
{
services.AddDbContext<CprDbContext>(options => options
.UseNpgsql(connection, x => x.UseNetTopologySuite())
.UseExceptionProcessor(options);
);
}
else
{
services.AddDbContext<CprDbContext>(options => options
.UseSqlServer(connection, x => x.UseNetTopologySuite())
.UseExceptionProcessor(options)
);
}
Obviously, this gives:
The call is ambiguous between the following methods or properties: 'EntityFramework.Exceptions.PostgreSQL.ExceptionProcessorExtensions.UseExceptionProcessor(Microsoft.EntityFrameworkCore.DbContextOptionsBuilder)' and 'EntityFramework.Exceptions.SqlServer.ExceptionProcessorExtensions.UseExceptionProcessor(Microsoft.EntityFrameworkCore.DbContextOptionsBuilder)'
I could use AddInterceptors() rather than UseExceptionProcessor() if the interceptors were public, but since they aren't, how can I manage to accomplish this for a database determined purely by its connection string?
In Startup.cs I have
Obviously, this gives:
I could use
AddInterceptors()
rather thanUseExceptionProcessor()
if the interceptors were public, but since they aren't, how can I manage to accomplish this for a database determined purely by its connection string?