MC_2018
MC_2018
Explore posts from servers
CC#
Created by MC_2018 on 12/29/2023 in #help
DbContext with IServiceProvider: whether or not to have a using statement
Hello, I have a straightforward question regarding using a DbContext from IServiceProvider. I'm aware that traditionally, when creating a DbContext, you should have a using statement; is this still needed when using the IServiceProvider?
using var context = Program.ServiceProvider.GetRequiredService<ShuffullContext>();
using var context = Program.ServiceProvider.GetRequiredService<ShuffullContext>();
Or does the IServiceProvider handle disposal and no longer require it?
var context = Program.ServiceProvider.GetRequiredService<ShuffullContext>();
var context = Program.ServiceProvider.GetRequiredService<ShuffullContext>();
3 replies
CC#
Created by MC_2018 on 1/26/2023 in #help
❔ Locally-hosting my site, cannot view on phone (MVC)
18 replies