Difference between NpgsqlDataSourceBuilder.EnableDynamicJson and NpgsqlConnection.GlobalTypeMapper.EnableDynamicJson()
Mantenedores costumam responder em até 1 dia
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 4/5
- Tempo estimado
- 3-5 dias
- Facilidade para iniciantes
- 25/100
Direção de pesquisa
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.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
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
}
- Linguagem predominante
- C#
- Estrelas
- 1.8k
- Forks
- 268
- Merge médio
- 2h 35min
- PRs com merge (30d)
- 136
Preparar o ambiente
Este projeto não oferece contêiner de desenvolvimento, Dockerfile nem guia de contribuição, então a configuração fica por sua conta: comece pelo README e veja nosso guia da primeira contribuição para os passos gerais.
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de npgsql/efcore.pg
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 82/100
Mantenedores costumam responder em até 1 dia
-
NTS: the M ordinate is dropped from geometry SQL literals and from geometries stored in JSONTalvez já em andamento @Ahmed7991 assumiu há 6 dias. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 85/100
npgsql/efcore.pg#4093 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
`TimeSpan`/`Duration` component members: negative values are floored, and intervals computed in SQL are read field by fieldTalvez já em andamento @jeremy-morren assumiu há 12 dias. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 70/100
Mantenedores costumam responder em até 1 dia
-
Numeric storage parameters are formatted with the current culture, so migrations emit 0,01 instead of 0.01Talvez já em andamento @Sorbitol assumiu há 12 dias. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 30/100
Mantenedores costumam responder em até 1 dia
-
`Contains` on a JSON primitive collection compares JSON text, so `DateTime` and `TimeOnly` items never matchTalvez já em andamento @Mr444-dev assumiu há 8 dias. Aberta
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 45/100
npgsql/efcore.pg#4099 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
Todas as issues de npgsql/efcore.pg
Issues semelhantes
-
Dificuldade 1/5 1-3 horas Facilidade para iniciantes 90/100
ShareX/XerahS#316 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 68/100
SubtitleEdit/subtitleedit#16825 ·
Mantenedores costumam responder em até 1 dia
-
ci-flake kind:tests size:S type:bug
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 82/100
elsa-workflows/elsa-foundation#4058 · 1 reação ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 77/100
games-on-whales/wolf-ui#23 ·
-
SkillsAbertawayfinder:grilling
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 64/100
DigiBanks99/lopen#37 ·