我需要在我的 ASP.NET MVC 应用程序中使用多个连接字符串。我该怎么做?现在我正在注册连接,如下所示:
builder.RegisterType<SqlConnection>().WithParameter(
"connectionString",
WebConfigurationManager.ConnectionStrings["MyConnectionString"].ConnectionString)
.InstancePerLifetimeScope()
.ExternallyOwned();
builder.Register(c => new ContextDataContext(c.Resolve<SqlConnection>())).InstancePerDependency();