Untitled

Random thoughts about everything and nothing

ExpressionBuilder

leave a comment »

While fooling around with my Web.config I stumbled on a nice feature in ASP.NET (2.0): ExpressionBuilder classes.

Basically, these classes let you set control properties through *ahem* expressions.

When the page is parsed, the declarative expressions will be used to retrieve the actual value(s). This done through the ExpressionBuilder class.

The framework ships with three expression builder classes, each accessing different resource settings:

  • AppSettingsExpressionBuilder, allows access to the connection strings stored in section of the configuration file;
  • ConnectionStringsExpressionBuilder, allows access to the application settings stored in section of the configuration file;
  • ResourceExpressionBuilder, allows access to localized resources, typically stored in .resx files located in the App_GlobalResources and App_LocalResources folders.

To actually set these expressions, we don’t need to write it out in the property, but we can use Property Inspector > Data > Expressions.

Now the really nice part is yet to come, we can create our own ExpressionBuilders (both design/run-time support). A good place to start is here and ofcourse your local MSDN documentation.

Advertisements

Written by Michael

March 5, 2006 at 10:51 pm

Posted in .NET, Article

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: