I am creating an ASP.NET Core 6 Web API, but I have some legacy libraries I have to use that are dependent on EF 6 (not EF Core).
I see in those libraries dbcontext is getting initialised with parameterless constructors i.e. not passing connection string, dbOptions, etc.
I see it defaulting to localdb for dbserver.
using (var context = new AppSettingDb())
{
var item = context.AppSettings.FirstOrDefault(x => x.SettingName == settingName);
if (item == null) throw new AppSettingException() { AppName = _appName, SettingName = settingName };
return item.Value;
}
Is there anyway of changing the default connection string to be used when context is created? I tried to add a web.config to my .NET 6 project, it did not work.
Not quite sure, but is this what you are looking for?