I have code using EF with a connection string as in web.config (spaces and line breaks for clarity) :
connectionString=
metadata=res://*/Models.XXXDataContext.csdl|
res://*/Models.XXXDataContext.ssdl|
res://*/Models.XXXDataContext.msl;
provider=System.Data.SqlClient;
provider connection string="data source=xxxxxxxxxx.database.windows.net,1433;
initial catalog=db1;
user id=dba;
password=its-a-secret(bazinga!);
MultipleActiveResultSets=True;
App=EntityFramework"
I want to use the same connection string to execute a stored procedure to perform a merge insert/update
to another table.
Can I user the connection string as is to create sqlConnection(cnns-tring)
?
What is the purpose of the metadata=res: ...
entry here? also MultipleActiveResultSets=True
and App=EntityFramework
? Would they have any impact here?
The metadata property specifically points to the location of the .SSDL (Storage Model,) .CSDL (Conceptual Model,) and .MSL (Mapping Model) files. These three files essentially are the Entity Data Model. The "res://" URI-style qualifier indicates that the files are embedded as resources in the compiled EDM assembly.
MultipleActiveResultSets - Multiple Active Result Sets (MARS) is a feature that works with SQL Server to allow the execution of multiple batches on a single connection. When MARS is enabled for use with SQL Server, each command object used adds a session to the connection.
App=EntityFramework: It's just the synonym of the Application Name. All connectionstring keywords are explained here: https://msdn.microsoft.com/en-gb/library/system.data.sqlclient.sqlconnection.connectionstring.aspx