csharpfritz / csharpfritz/InstantAPIs

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

Open
#74 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
453
Forks
58
PR merge metrics
No merged PRs in 30d

Description

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();
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.