Base solution for your next web application

Activities of "giamdoc"

Thank you.

I have found the solution. However I am having problem getting Database Data from Startup class. Is there a way to access DbConext at MVC's startup?

Ex: if (bool.Parse(_appConfiguration["IdentityServer:IsEnabled"])) {

            //Get ClientID from Database
            
            var context = services.BuildServiceProvider().GetService<MyDbContext>();
            var clientIds = GetClientIds(context);
            
            //What do I need to write to be able to access the database here?
            
            IdentityServerRegistrar.Register(services, _appConfiguration, options => options.UserInteraction =
                new UserInteractionOptions
                {
                    LoginUrl = "/Account/Login",
                    LogoutUrl = "/Account/LogOut",
                    ErrorUrl = "/Error"
                }, clientIds);
        }

Thank you for the feedback.

If I use the method you sent, will the information stored in the database be cached? Or it will access to the Database every time there is a request. Is there any solution for me to use the database and AddMemory at the same time?

Showing 1 to 2 of 2 entries