Most of the time you don't need to have multiple database providers, for example, you start with the SQL Server provider and there is no need to sw...
For further actions, you may consider blocking this person and/or reporting abuse
I couldn't use this approach with the IdentityDbContext. TContextService and TContextImplementation logic don't work as expected. And I got an error like this;
"An error occurred while accessing the Microsoft.Extensions.Hosting services. Continuing without the application service provider. Error: Some services are not able to be constructed (Error while validating the service descriptor..."
Do you have any idea to fix this situation?
I upgraded the sample project in GitHub to .NET 7.0 and it's working fine. Please follow the sample project or share your codes by a git repo.
Thanks for the reply. I handled it somehow. I'll also look at your repo.
can you add nosql database like azure cosmos documentdb?
Sure, it's just like PostgresSQL but it does not need to generate migration at all, and by calling
context.Database.EnsureCreated()
database will be created. Check out the sample project on github.thanks, i'll check
Is there a way to get rid of options.UseSqlServer(Configuration.GetConnectionString("MsSqlConnection")); to MsSqlDbContext and pass the connection string when services.AddDbContext(); ?
I ask because if the work with DbContext is transferred to a separate project as a library, then it will not be correct for this library to have a strictly fixed entry to the path to the Database. (Configuration.GetConnectionString("MsSqlConnection"))
@magals you can inject a model that has a connection string property instead of
IConfiguration
to DbContext and get ride of hardcoded key name.Could you please comment why not?
Because
ApplyConfigurationsFromAssembly
scans the assembly and loads all configuration but only provider-specific configuration should be added.you can use filter
Thanks