Evaluates expressions during page parsing.
Assembly: System.Web (in System.Web.dll)
When overridden in a derived class, returns a value indicating whether the currentobject supports no-compile pages.
Determines whether the specified object is equal to the current object.(Inherited from Object.)
|EvaluateExpression(Object, BoundPropertyEntry, Object, ExpressionBuilderContext)|
When overridden in a derived class, returns an object that represents an evaluated expression.
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.(Inherited from Object.)
|GetCodeExpression(BoundPropertyEntry, Object, ExpressionBuilderContext)|
When overridden in a derived class, returns code that is used during page execution to obtain the evaluated expression.
Serves as the default hash function. (Inherited from Object.)
|ParseExpression(String, Type, ExpressionBuilderContext)|
When overridden in a derived class, returns an object that represents the parsed expression.
Returns a string that represents the current object.(Inherited from Object.)
The AppSettingsExpressionBuilder class, that create code expressions during page parsing.class is the base class for expression builders, such as the
Expression builders parse declarative expressions and create code to retrieve values bound to a control property. In no-compile scenarios, an expression builder that supports a no-compile feature evaluates the expression during run time.
When the page parser encounters an expression that is delimited with the string <%$ %>, it creates an expression builder for the expression based on the prefix in the string. The prefix is the portion of the string that is to the left of the colon (:). For example, when the parser encounters the string <%$ ConnectionStrings:MessageDB %>, it creates a ConnectionStringsExpressionBuilder object. Prefixes are associated with expression builders in the Web.config file in the ExpressionBuilders section.
The right side of the declarative expression is passed to the expression builder for evaluation. Override the GetCodeExpression method to generate code that will be compiled with the page.
If you want the custom expression builder to be active on pages that are not compiled, you must also override the EvaluateExpression method to return an object that represents the results of the expression. You also must override the SupportsEvaluate property to indicate that the custom expression builder does support no-compile pages.
You can define a set of properties and methods for selecting and evaluating an expression that is associated with a control property at design time by implementing an expression editor. The editor is marked on the expression builder through class-level metadata. For more information, see ExpressionEditor.
Notes to Inheritors:
When you inherit from the GetCodeExpression method.class, you must override the
The following code examples demonstrate how to build a custom expression builder by implementing theabstract class. This implementation of returns an evaluated statement that is passed to the expression. To run this example, you must first register the custom expression builder in the Web.config file. The first code example demonstrates how to register the custom expression builder in the Web.config file.
<configuration> <system.web> <compilation> <expressionBuilders> <add expressionPrefix="MyCustomExpression" type="MyCustomExpressionBuilder"/> </expressionBuilders> </compilation> </system.web> </configuration>
The second code example demonstrates how to reference the expression in an .aspx file.
<asp:Label ID="Label1" runat="server" Text="<%$ MyCustomExpression:Hello, world! %>" />
The third code example demonstrates how to develop a customized expression builder by deriving from. To run this code example, you must place the class in the App_Code folder.
Available since 2.0
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.