Skip to content

builder.Services.AddDbContext<MyContext>(ServiceLifetime.Transient)? #3209

Discussion options

You must be logged in to vote

Thank you.
I just realized I was using the following on my Program.cs
builder.Services.AddSingleton(s => new ASPNetContext(aspnetdb_connectionString));
so I changed it to
builder.Services.AddTransient(s => new ASPNetContext(aspnetdb_connectionString));
Thank you @michaelcsikos

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@michaelcsikos
Comment options

@jhuerta3
Comment options

Answer selected by rockfordlhotka
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants