1

How can I pass in a connection string from the controller during runtime in an an MVC Core app? I want to let the user choose a database to connect to.

 public void ConfigureServices(IServiceCollection services)
        {
            var connection = @"Pass from controller?";
            services.AddDbContext<DataLoaderConfigContext>(options => options.UseSqlServer(connection));

            services.AddMvc();
        }
Cookie Monster
  • 475
  • 6
  • 12
  • Have you tried the solutions in [here](https://stackoverflow.com/questions/39083372/how-to-read-connection-string-in-net-core) or [here](https://stackoverflow.com/questions/47527344/access-connection-string-inside-an-asp-net-core-controller)? – RyeBread Jun 12 '18 at 21:57

0 Answers0