Difference between NpgsqlDataSourceBuilder.EnableDynamicJson and NpgsqlConnection.GlobalTypeMapper.EnableDynamicJson()
Maintainer antworten meist innerhalb von 1 Tag
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Anfängerfreundlichkeit
- 25/100
Rechercherichtung
No source files or tests are named. Start by reading the Npgsql EF Core provider guidance for NpgsqlDataSourceBuilder.EnableDynamicJson, ConfigureDataSource, and UseNpgsql; compare how each configuration is applied to both DbContexts. Done means identifying why the shown setups still raise the exception and establishing a non-deprecated configuration that works for both contexts.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
Hello, we are migrating from the older version to a newer version of both npgsql and EF Core. As we have so many jsonb columns throughout the application, we have chosen to EnableDynamicJson, but we couldn't get rid of the exceptions that suggest enabling dynamic json serialization. We have two DbContexts in our app. At first, I tried to fix the issue by passing the NpgsqlDataSource manually like below, doing it separately for both contexts:
var dataSourceBuilder = new NpgsqlDataSourceBuilder(config.ConnectionStrings.AppDb);
dataSourceBuilder.EnableDynamicJson();
builder.UseNpgsql(dataSourceBuilder.Build(), options =>
{
options.MigrationsAssembly(asmName);
})
// repeat for the other datasource
This didn't work. Also tried below separately :
builder.UseNpgsql(config.ConnectionStrings.AppDb, options =>
{
options.MigrationsAssembly(asmName);
options.ConfigureDataSource(ds => ds.EnableDynamicJson());
})
// repeat for the other datasource
Also tried to inject NpgsqlDataSource via DI like the below :
services.AddNpgsqlDataSource(config.ConnectionStrings.ScrapDb, builder=> builder.EnableDynamicJson(),
serviceKey: "ScrapDataSource");
services.AddNpgsqlDataSource(config.ConnectionStrings.AppDb, builder=> builder.EnableDynamicJson(),
serviceKey: "AppDataSource");
builder.UseNpgsql(sp.GetKeyedService<NpgsqlDataSource>("AppDataSource"),
options => options.MigrationsAssembly(asmName))
)
// repeat for the other datasource
The only solution that has worked so far is to use NpgsqlConnection.GlobalTypeMapper.EnableDynamicJson(). (Which we want to avoid as it is deprecated.) I don't know what I am currently doing wrong, or if it is somehow related to having multiple DbContexts.
I also don't have any OnConfiguring overrides in my DbContexts. They are just accept DbContextOptions like the below:
public partial class AppDbContext : DbContext
{
public AppDbContext()
{
}
public AppDbContext(DbContextOptions<AppDbContext> options) : base(options)
{
}
// dbsets here
}
public class ScrapDbContext : DbContext
{
public ScrapDbContext()
{
}
public ScrapDbContext(DbContextOptions<ScrapDbContext> options) : base(options)
{
}
// dbsets here
}
- Vorherrschende Sprache
- C#
- Sterne
- 1.8k
- Forks
- 268
- Ø Merge
- 2 Std. 35 Min.
- Gemergte PRs (30 T.)
- 136
Entwicklungsumgebung
Dieses Projekt bietet weder Dev-Container noch Dockerfile noch Beitragsleitfaden – die Einrichtung liegt bei Ihnen. Beginnen Sie mit der README; die allgemeinen Schritte stehen in unserem Leitfaden für den ersten Beitrag.
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus npgsql/efcore.pg
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
Maintainer antworten meist innerhalb von 1 Tag
-
NTS: the M ordinate is dropped from geometry SQL literals and from geometries stored in JSONEvtl. vergeben @Ahmed7991 hat das vor 6 Tagen übernommen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 85/100
npgsql/efcore.pg#4093 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
`TimeSpan`/`Duration` component members: negative values are floored, and intervals computed in SQL are read field by fieldEvtl. vergeben @jeremy-morren hat das vor 12 Tagen übernommen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 70/100
Maintainer antworten meist innerhalb von 1 Tag
-
Numeric storage parameters are formatted with the current culture, so migrations emit 0,01 instead of 0.01Evtl. vergeben @Sorbitol hat das vor 12 Tagen übernommen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 30/100
Maintainer antworten meist innerhalb von 1 Tag
-
`Contains` on a JSON primitive collection compares JSON text, so `DateTime` and `TimeOnly` items never matchEvtl. vergeben @Mr444-dev hat das vor 7 Tagen übernommen. Offen
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 45/100
npgsql/efcore.pg#4099 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in npgsql/efcore.pg
Ähnliche Issues
-
ci-flake kind:tests size:S type:bug
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 82/100
elsa-workflows/elsa-foundation#4058 · 1 Reaktion ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 77/100
games-on-whales/wolf-ui#23 ·
-
SkillsOffenwayfinder:grilling
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 64/100
DigiBanks99/lopen#37 ·
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 66/100
sebastienros/fluid#1273 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
Maintainer antworten meist innerhalb von 1 Tag