EntityConnectionStringBuilder 類別
組件: System.Data.Entity (在 System.Data.Entity.dll 中)
EntityConnectionStringBuilder 型別會公開下列成員。
| 名稱 | 說明 | |
|---|---|---|
| EntityConnectionStringBuilder() |
|
|
| EntityConnectionStringBuilder(String) |
|
| 名稱 | 說明 | |
|---|---|---|
| BrowsableConnectionString |
|
|
| ConnectionString |
|
|
| Count |
|
|
| IsFixedSize |
|
|
| IsReadOnly |
|
|
| Item |
|
|
| Keys |
|
|
| Metadata |
|
|
| Name |
|
|
| Provider |
|
|
| ProviderConnectionString |
|
|
| Values |
|
| 名稱 | 說明 | |
|---|---|---|
| Add |
|
|
| Clear |
|
|
| ClearPropertyDescriptors |
|
|
| ContainsKey |
|
|
| Equals(Object) |
|
|
| EquivalentTo |
|
|
| Finalize |
|
|
| GetHashCode |
|
|
| GetProperties |
|
|
| GetType |
|
|
| MemberwiseClone |
|
|
| Remove |
|
|
| ShouldSerialize |
|
|
| ToString |
|
|
| TryGetValue |
|
| 名稱 | 說明 | |
|---|---|---|
| ICollection.CopyTo |
|
|
![]() |
ICollection.IsSynchronized |
|
![]() |
ICollection.SyncRoot |
|
| ICustomTypeDescriptor.GetAttributes |
|
|
| ICustomTypeDescriptor.GetClassName |
|
|
| ICustomTypeDescriptor.GetComponentName |
|
|
| ICustomTypeDescriptor.GetConverter |
|
|
| ICustomTypeDescriptor.GetDefaultEvent |
|
|
| ICustomTypeDescriptor.GetDefaultProperty |
|
|
| ICustomTypeDescriptor.GetEditor |
|
|
| ICustomTypeDescriptor.GetEvents() |
|
|
| ICustomTypeDescriptor.GetEvents(Attribute[]) |
|
|
| ICustomTypeDescriptor.GetProperties() |
|
|
| ICustomTypeDescriptor.GetProperties(Attribute[]) |
|
|
| ICustomTypeDescriptor.GetPropertyOwner |
|
|
| IDictionary.Add |
|
|
| IDictionary.Contains |
|
|
| IDictionary.GetEnumerator |
|
|
![]() |
IDictionary.Item |
|
| IDictionary.Remove |
|
|
| IEnumerable.GetEnumerator |
|
// Specify the provider name, server and database. string providerName = "System.Data.SqlClient"; string serverName = "."; string databaseName = "AdventureWorks"; // Initialize the connection string builder for the // underlying provider. SqlConnectionStringBuilder sqlBuilder = new SqlConnectionStringBuilder(); // Set the properties for the data source. sqlBuilder.DataSource = serverName; sqlBuilder.InitialCatalog = databaseName; sqlBuilder.IntegratedSecurity = true; // Build the SqlConnection connection string. string providerString = sqlBuilder.ToString(); // Initialize the EntityConnectionStringBuilder. EntityConnectionStringBuilder entityBuilder = new EntityConnectionStringBuilder(); //Set the provider name. entityBuilder.Provider = providerName; // Set the provider-specific connection string. entityBuilder.ProviderConnectionString = providerString; // Set the Metadata location. entityBuilder.Metadata = @"res://*/AdventureWorksModel.csdl| res://*/AdventureWorksModel.ssdl| res://*/AdventureWorksModel.msl"; Console.WriteLine(entityBuilder.ToString()); using (EntityConnection conn = new EntityConnection(entityBuilder.ToString())) { conn.Open(); Console.WriteLine("Just testing the connection."); conn.Close(); }
Windows 7, Windows Vista SP1 (含) 以後版本, Windows XP SP3, Windows Server 2008 (不支援伺服器核心), Windows Server 2008 R2 (SP1 (含) 以後版本支援伺服器核心), Windows Server 2003 SP2
.NET Framework 並不支援各種平台的所有版本。如需支援的版本的清單,請參閱.NET Framework 系統需求。

