You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
AddDataContextSQL provides optional param to extend SQL dbContext like using NetToplogySutie
However it leads to fail to connect to db using correct connection string
---> System.InvalidOperationException: A relational store has been configured without specifying either the DbConnection or connection string to use.
at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.get_DbConnection()
Expected behavior
200 OK and data should be returned correctly
Desktop (please complete the following information):
OS: Windows 11
Browser Edge
Version 122.0.2365.80 / 64bit
Additional context
Workaround: Register GenericDbContext using AddDbContext and UseSqlServer directly before call AddDataContextSQL
// Add API Generator and load data
var api_generator = builder.Services.AddApiGeneratorServices()
.AddAssemblyWithOData(Assembly.GetExecutingAssembly());
api_generator.Services.AddDbContext<GenericDbContext>(options => options.UseSqlServer(
myconnectionstring,
x => x.UseNetTopologySuite()).EnableSensitiveDataLogging()
.LogTo(Console.WriteLine, LogLevel.Information));
api_generator.AddDataContextSQL()
.AddOData()
.AddSwagger(true);
Should be due to here and here
connection string is not passed to UseSqlServer
The text was updated successfully, but these errors were encountered:
Describe the bug
AddDataContextSQL provides optional param to extend SQL dbContext like using NetToplogySutie
However it leads to fail to connect to db using correct connection string
To Reproduce
Steps to reproduce the behavior:
Expected behavior
200 OK and data should be returned correctly
Desktop (please complete the following information):
Additional context
connection string is not passed to UseSqlServer
The text was updated successfully, but these errors were encountered: