EntityDataSource.ConnectionString 属性
定义
获取或设置用于执行查询的连接字符串。Gets or sets the connection string that is used to execute the query.
public:
property System::String ^ ConnectionString { System::String ^ get(); void set(System::String ^ value); };
public string ConnectionString { get; set; }
member this.ConnectionString : string with get, set
Public Property ConnectionString As String
属性值
查询的连接字符串。The connection string for the query.
注解
ConnectionString EntityDataSource 可以通过存储在应用程序配置文件的connectionStrings元素中的命名 EDM 连接字符串来初始化控件的属性。The ConnectionString property of the EntityDataSource control can be initialized from a named EDM connection string stored in the connectionStrings element of the application configuration file. 当使用实体数据模型向导创建 EDM 时,将在应用程序配置文件中创建一个名为 EDM 的连接。When the EDM is created by using the Entity Data Model Wizard, a named EDM connection is created in the application configuration file. 在应用程序配置文件中找到命名的 EDM 连接字符串后,连接将在 EntityDataSource 设计器的 "配置数据源" 向导中显示为一个选项。When a named EDM connection string is found in the application configuration file, the connection is visible as an option in the Configure Data Source wizard of the EntityDataSource designer. 有关详细信息,请参阅 配置数据源向导 (EntityDataSource Control) 。For more information, see Configure Data Source Wizard (EntityDataSource Control).
如果 ContextTypeName 未指定属性,则 DefaultContainerName ConnectionString 必须设置和属性以使控件创建 ObjectContext 。If the ContextTypeName property is not specified, both the DefaultContainerName and ConnectionString properties must be set for the control to create the ObjectContext.