How to pass connection string in .net core 7
var connectionString = builder.Configuration.GetConnectionString("HotelListingConnection");
builder.Services.AddDbContext(options => { options.UseSqlServer(connectionString); });
i'm getting error:
The type 'HotelDbContext' cannot be used as type parameter 'TContext' in the generic type or method 'EntityFrameworkServiceCollectionExtensions.AddDbContext

Tahir AnsariPosted Dec 21, 2022, 5:52 AM
it was my mistake i'm direclty register adddbcontext in program.cs except creating dbcontext.cs file
Thanks
Aravind GovindarajPosted Dec 20, 2022, 6:47 PM
can you kindly refer this please
https://stackoverflow.com/questions/39083372/how-to-read-connection-string-in-net-core