Entity Framework Connection String


 

Code Snippet
  1. using System.Data.EntityClient;
  2.  
  3.             EntityConnectionStringBuilder entityConString = new EntityConnectionStringBuilder()
  4.             {
  5.                 Metadata = @"res://*/Model1.csdl|res://*/Model1.ssdl|res://*/Model1.msl",
  6.                 Provider = "System.Data.SqlClient",
  7.                 ProviderConnectionString = new System.Data.SqlClient.SqlConnectionStringBuilder
  8.                 {
  9.                     InitialCatalog = dbname,
  10.                     DataSource = servername,
  11.                     IntegratedSecurity = false,
  12.                     UserID = user,
  13.                     Password = pwd
  14.                 }
  15.  
  16.                 .ConnectionString
  17.             };
  18.             return entityConString.ToString();

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s