October 3, 2013 | Posted in: .Net

Not quite the same as the conventional ADO.Net connection string. Quick function to return the required format by Entity Framework:

Public Shared Function EntityFrameworkConnectionString() As String
Dim efConnectionString As String = New System.Data.EntityClient.EntityConnectionStringBuilder() _
With {.Metadata = “res://*”, _
.Provider = “System.Data.SqlClient”, _
.ProviderConnectionString = New System.Data.SqlClient.SqlConnectionStringBuilder() _
With {.InitialCatalog = “DatabaseName”, _
.DataSource = “ServerName”, _
.IntegratedSecurity = True
Return efConnectionString
End Function

Be the first to comment.

Leave a Reply


12 + 1 =

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>