Fluent sample for entlib 5.0

Topics: General discussion
Feb 2, 2010 at 12:30 PM


I really look forward to the fluent configuration style of the new entlib, as that is currently our biggest pain: the massive XML files.

However, I can't seem to find an example to get started with the logging sample; is there anywhere a blog entry about it? Furthermore, I really, really look forward to the fluent interface style of the validation application block. Is that one scheduled to come soon?


Best regards from Belgium,


Feb 2, 2010 at 1:07 PM

What logging sample specifically are you looking for?  And I think  yes, the fluent interface style will cover all blocks. 


Sarah Urmeneta
Global Technology and Solutions
Avanade, Inc.

Feb 2, 2010 at 2:08 PM

Hello Sarah,

I'll appreciate your quick reaction.

About the fluent interface style of the application block, I understood it as an alternative for the massive XML declarations in my web.config, with for example the details from the logging applicatrion block. When I open the LoggingQuickStart sample delivered with the preview,, I still see the following XML configuration in my web.config:


<loggingConfiguration tracingEnabled="true" defaultCategory="General">
		<!-- content removed for readability  -->
	<!-- other content removed for readability  -->


I'm hoping, following the fluent interface concept, I have somewhere the possibility to write in fluent interface style the configuration, like adding LogFiilters, Categories, Listeners and others in a potental way like .


    .AddFilter(/* */)






Feb 3, 2010 at 5:37 AM

I'm not sure yet Dirk if they're going to modify the xml format, I also tried the latest drop, used the config tool and the format's still the same.  I do know there were changes in the Unity config but for the rest, no change yet.


Sarah Urmeneta
Global Technology and Solutions
Avanade, Inc.

Feb 3, 2010 at 10:06 AM

Hi Sarah,

I think they will; there is a Enterprise Library 5.0 preview video posted on this blog http://blogs.msdn.com/agile/default.aspx, where an example is shown on the screen at 23:32. It would be nice if there would be  more examples included in the Quick Starts like the one from the video, to explain how to use the fluent style for example in a web application, or how to build a validation class using the fluent interface style. This is something where we are the Microsoft team really grateful for :).

Thank you for your help,

Best regards






Feb 3, 2010 at 10:21 AM

I've watched that one and yeah, I really think the fluent interface is cool.  However, what I'm talking about is that I'm not sure if the xml configuration format will also be changed.  I think they could introduce the fluent interface without changing the configuration format so that the lower versions of the config would still continue to work with v5.0 by just modifying the version number and publickeytoken.  That is, avoid breaking changes on the configuration side.


Sarah Urmeneta
Global Technology and Solutions
Avanade, Inc.

Feb 12, 2010 at 7:16 AM

The fluent interface is an addition to, not a replacement of, the XML config. The fluent interface is great if you know, at compile time, what your settings have to be. However, in many cases (like deploying in a data center) your administrators need to be able to change settings without recompiling the app. So the two play different roles. Also, there are hundreds of thousands of lines of Entlib XML config files out there; we'd probably really anger people if we told them all you had to get rid of them. It's bad enough getting people to change version numbers. :-) So you have a choice based on what you find easier and what your needs are for configuring Entlib.

We haven't gotten to updating the quickstart examples yet; I'll take a note and try to make sure we include an example for each block in them when we get there.

As for validation, well - you can actually build validators pretty easily just by newing them up, so we don't have a fluent config builder for them. However, again, I think it's appropriate to include an example of programmatically creating them somewhere.