using System.Data.EntityClient;
private string GetADOConnectionString()
{
DBEntities ctx = new DBEntities(); //create your entity object here
EntityConnection ec = (EntityConnection)ctx.Connection;
SqlConnection sc = (SqlConnection)ec.StoreConnection; //get the SQLConnection that your entity object would use
string adoConnStr = sc.ConnectionString;
return adoConnStr;
}
Code (VB.NET)
Private Function GetADOConnectionString() As String
Dim ctx As New DBEntities()
'create your entity object here
Dim ec As EntityConnection = DirectCast(ctx.Connection, EntityConnection)
Dim sc As SqlConnection = DirectCast(ec.StoreConnection, SqlConnection)
'get the SQLConnection that your entity object would use
Dim adoConnStr As String = sc.ConnectionString
Return adoConnStr
End Function