ConnectionStringsExpressionBuilder.EvaluateExpression(Object, BoundPropertyEntry, Object, ExpressionBuilderContext) 方法
定义
从 Web.config 文件的 <connectionStrings> 节返回一个值。Returns a value from the <connectionStrings> section of the Web.config file.
public:
override System::Object ^ EvaluateExpression(System::Object ^ target, System::Web::UI::BoundPropertyEntry ^ entry, System::Object ^ parsedData, System::Web::Compilation::ExpressionBuilderContext ^ context);
public override object EvaluateExpression (object target, System.Web.UI.BoundPropertyEntry entry, object parsedData, System.Web.Compilation.ExpressionBuilderContext context);
override this.EvaluateExpression : obj * System.Web.UI.BoundPropertyEntry * obj * System.Web.Compilation.ExpressionBuilderContext -> obj
Public Overrides Function EvaluateExpression (target As Object, entry As BoundPropertyEntry, parsedData As Object, context As ExpressionBuilderContext) As Object
参数
- target
- Object
包含表达式的对象。The object that contains the expression.
- entry
- BoundPropertyEntry
表达式绑定到的属性。The property to which the expression is bound.
- parsedData
- Object
表示由 ParseExpression(String, Type, ExpressionBuilderContext) 返回的已分析数据的对象。The object that represents parsed data as returned by ParseExpression(String, Type, ExpressionBuilderContext).
- context
- ExpressionBuilderContext
控件或页的属性。Properties for the control or page.
返回
与 Web.config 文件的 <connectionStrings> 节中某个键关联的 Object。The Object associated with a key in the <connectionStrings> section of the Web.config file.
例外
未能在 Web.config 文件中找到连接字符串名称。The connection string name could not be found in the Web.config file.
注解
在 <%$ ConnectionStrings: secureConnectionString %> 未编译的页面中遇到形式的表达式时,将调用此方法。This method is called when an expression of the form <%$ ConnectionStrings: secureConnectionString %> is encountered in a page that is not compiled. 它从 Web.config 文件的部分中检索相应的值 <connectionStrings> 。It retrieves the appropriate value from the <connectionStrings> section of the Web.config file. EvaluateExpression GetConnectionString 如果参数中包含连接字符串,则此方法通过调用方法来重写方法 parsedData ; GetConnectionStringProviderName 如果参数中未包含连接字符串,则通过调用方法 parsedData 来重写方法。This method overrides the EvaluateExpression method by calling the GetConnectionString method if a connection string is included in the parsedData parameter, or by calling the GetConnectionStringProviderName method if a connection string is not included in the parsedData parameter.