csharpfritz / csharpfritz/InstantAPIs

KeyNotFoundException: The given key 'xxxx.DataModel.Models.AspNetUserLogin' was not present in the dictionary.

Aperta
#74 1 commento 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
C#
Stelle
453
Fork
58
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

Anyone can help find out why im getting this error?

**KeyNotFoundException: The given key 'dbContext.DataModel.Models.AspNetUserLogin' was not present in the dictionary.**

![Snipaste_2023-08-05_23-57-18](https://github.com/csharpfritz/InstantAPIs/assets/1240729/f6e5242e-95fe-4842-9084-cd7598c61f57)

Here is part of my Program.cs

```
builder.Services.AddSqlServer(builder.Configuration.GetConnectionString("DefaultConnectionLocal"));

// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();
builder.Services.AddApplicationInsightsTelemetry();

builder.Services.AddInstantAPIs();

var app = builder.Build();

// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{
app.UseSwagger();
app.UseSwaggerUI();
}

app.UseSwagger();
app.UseSwaggerUI();

app.UseHttpsRedirection();

// Use CORS
app.UseCors();

app.UseAuthorization();

app.MapControllers();

app.MapInstantAPIs();

app.Run();
```

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Start with the Program.cs excerpt and reproduce the failure around AddInstantAPIs() and MapInstantAPIs(), using the reported KeyNotFoundException as the symptom. Trace which dictionary lookup involves dbContext.DataModel.Models.AspNetUserLogin and compare it with the Entity Framework configuration supplied through AddSqlServer(). Done means identifying the missing key or configuration mismatch and documenting a confirmed fix.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
csharp
Ambito
api, backend
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Da chiarire
Idoneità per principianti
20/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.