AppSettingsExpressionBuilder.EvaluateExpression(Object, BoundPropertyEntry, Object, ExpressionBuilderContext) Method

Definition

从 Web.config 文件的 <appSettings> 节返回一个值。Returns a value from the <appSettings> 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

Parameters

target
Object

包含属性项的对象。The object that contains the property entry.

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.

Returns

Object

与 Web.config 文件的 Object 部分中某个键关联的 <appSettings>The Object associated with a key in the <appSettings> section of the Web.config file.

Remarks

当在无编译页中遇到形式 <%$ AppSettings: someApplicationSetting %> 的表达式时,将调用此方法。This method is called when an expression of the form <%$ AppSettings: someApplicationSetting %> is encountered in a no-compile page. 它从 web.config 文件的 <appSettings> 部分中的键/值对中检索相应的值。It retrieves the appropriate value from the key/value pairs in the <appSettings> section of the Web.config file. 此方法重写 EvaluateExpression,方法是将 Expression 属性的 GetAppSetting 方法作为 key 参数、Name 属性上的 PropertyEntry.PropertyInfo 属性作为 propertyName 参数,并将 Type 参数的 target 作为 targetType 参数。This method overrides EvaluateExpression by calling the GetAppSetting method with the Expression property as the key parameter, the Name property on the PropertyEntry.PropertyInfo property as the propertyName parameter, and the Type of the target parameter as the targetType parameter.

Applies to

See also