Dynamisch ändern die Verbindungszeichenfolge in Asp.Net Kern

Möchte ich ändern, sql-Verbindungszeichenfolge im controller, nicht in ApplicationDbContext. Ich bin mit Asp.Net Kern-und Entity Framework-Kern.

Beispiel:

public class MyController : Controller {
    private readonly ApplicationDbContext _dbContext
    public MyController(ApplicationDbContext dbContext)
    {
        _dbContext = dbContext;
    }
    private void ChangeConnectionString()
    {
    //So, what should be here?
    } }

Wie kann ich dies tun?

Dauerhaft oder vorübergehend für die Dauer der Anfrage?
temporäre, während der Laufzeit der controller.

InformationsquelleAutor Yurii N. | 2016-04-23

Schreibe einen Kommentar