How to enable MultipleActiveResultSets in an application running on appharbor with a sequencer add-in?

When developing locally, I have a connection string set with MultipleActiveResultSets set to TRUE. However, when I deploy my application and the connectionString sequencer receives an injection, MultipleActiveResultSets is not taken into account. Is there a way to enable MultipleActiveResultSets or otherwise update the connection string?

I am using Entity Framework 4.1 by the way.

+4
source share
1 answer

Update: Now you can enter several sets of active results (MARS) for the entered connection string using the Sequelizer admin panel. This is the recommended approach since web.config no longer needs to be changed, which causes AppDomain restart at startup

You can build a connection string from the URI entered into your web.config application. This process is described here , but I also included a snippet in it:

 var uriString = ConfigurationManager.AppSettings["SQLSERVER_URI"]; var uri = new Uri(uriString); var connectionString = new SqlConnectionStringBuilder { DataSource = uri.Host, InitialCatalog = uri.AbsolutePath.Trim('/'), UserID = uri.UserInfo.Split(':').First(), Password = uri.UserInfo.Split(':').Last(), MultipleActiveResultSets = true, }.ConnectionString; 

Notice MultipleActiveResultSets = true .

If you also need to create a connection string other than the first code, then you need to use EntityConnectionStringBuilder for the rest, for example:

 var builder = new EntityConnectionStringBuilder(); builder.ProviderConnectionString = connectionString; builder.Metadata = "somemetadata"; builder.Provider = "System.Data.SqlClient"; 

(also answered on the AppHarbor support forum )

+7
source

Source: https://habr.com/ru/post/1387637/


All Articles