<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Enterprise Library &#8211; Configuration Application Block &#8211; Patterns and Practices</title>
	<atom:link href="http://codebetter.com/davidhayden/2005/03/02/enterprise-library-configuration-application-block-patterns-and-practices/feed/" rel="self" type="application/rss+xml" />
	<link>http://codebetter.com/davidhayden/2005/03/02/enterprise-library-configuration-application-block-patterns-and-practices/</link>
	<description>CodeBetter.Com - Stuff you need to Code Better!</description>
	<lastBuildDate>Fri, 14 Jan 2011 18:21:41 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
	<item>
		<title>By: Val</title>
		<link>http://codebetter.com/davidhayden/2005/03/02/enterprise-library-configuration-application-block-patterns-and-practices/#comment-27</link>
		<dc:creator>Val</dc:creator>
		<pubDate>Mon, 21 Mar 2005 06:59:00 +0000</pubDate>
		<guid isPermaLink="false">/blogs/david.hayden/archive/2005/03/02/56345.aspx#comment-27</guid>
		<description><![CDATA[There is also restriction that different sections should be placed in different storage locations, because section name is used as a tag name for the top &lt;br&gt;element. At least this is so in current version implementation (Jan 2005). ]]></description>
		<content:encoded><![CDATA[<p>There is also restriction that different sections should be placed in different storage locations, because section name is used as a tag name for the top<br />
<br />element. At least this is so in current version implementation (Jan 2005). </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Marsha</title>
		<link>http://codebetter.com/davidhayden/2005/03/02/enterprise-library-configuration-application-block-patterns-and-practices/#comment-26</link>
		<dc:creator>Marsha</dc:creator>
		<pubDate>Thu, 10 Mar 2005 21:28:00 +0000</pubDate>
		<guid isPermaLink="false">/blogs/david.hayden/archive/2005/03/02/56345.aspx#comment-26</guid>
		<description><![CDATA[If the configuration section - i.e. SiteSettings encrypt property is set to encrypt=true in EL Configuration Console will the storage provider file be encrypted?  When &quot;SiteSettings&quot; encrypt is set to true,  I keep getting System.Security.Cryptography.CryptographicException: Length of the data to decrypt is invalid error even though the File Key Algorithm Storage Provider is configured.    And the .config file is not encrypted.  Thanks.]]></description>
		<content:encoded><![CDATA[<p>If the configuration section &#8211; i.e. SiteSettings encrypt property is set to encrypt=true in EL Configuration Console will the storage provider file be encrypted?  When &quot;SiteSettings&quot; encrypt is set to true,  I keep getting System.Security.Cryptography.CryptographicException: Length of the data to decrypt is invalid error even though the File Key Algorithm Storage Provider is configured.    And the .config file is not encrypted.  Thanks.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: David Hayden</title>
		<link>http://codebetter.com/davidhayden/2005/03/02/enterprise-library-configuration-application-block-patterns-and-practices/#comment-25</link>
		<dc:creator>David Hayden</dc:creator>
		<pubDate>Fri, 04 Mar 2005 13:06:00 +0000</pubDate>
		<guid isPermaLink="false">/blogs/david.hayden/archive/2005/03/02/56345.aspx#comment-25</guid>
		<description><![CDATA[Hi Nate,&lt;br&gt;&lt;br&gt;The only &quot;gotcha&quot; about web.config is that changing it causes a restart of the application.  You really don&#039;t want global settings in web.config that change often and don&#039;t require an application restart.  If you are essentially adding settings to web.config that rarely or never change, that is fine.  Volatile settings should be tossed in an XML file or database, depending on your application needs.&lt;br&gt;&lt;br&gt;The application block is cool, but could be overkill for smaller applications.  I tend to use separate XML files and my own serialization which I showed in a separate post.  You can add the global settings to the cache with a dependency on the XML file to remove it from the cache when a change is detected.  This is part of my web page inheritance model that I will toss up sometime this weekend I hope.  It is pretty basic and gives you another option for your web applications.]]></description>
		<content:encoded><![CDATA[<p>Hi Nate,</p>
<p>The only &quot;gotcha&quot; about web.config is that changing it causes a restart of the application.  You really don&#8217;t want global settings in web.config that change often and don&#8217;t require an application restart.  If you are essentially adding settings to web.config that rarely or never change, that is fine.  Volatile settings should be tossed in an XML file or database, depending on your application needs.</p>
<p>The application block is cool, but could be overkill for smaller applications.  I tend to use separate XML files and my own serialization which I showed in a separate post.  You can add the global settings to the cache with a dependency on the XML file to remove it from the cache when a change is detected.  This is part of my web page inheritance model that I will toss up sometime this weekend I hope.  It is pretty basic and gives you another option for your web applications.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nate</title>
		<link>http://codebetter.com/davidhayden/2005/03/02/enterprise-library-configuration-application-block-patterns-and-practices/#comment-24</link>
		<dc:creator>Nate</dc:creator>
		<pubDate>Fri, 04 Mar 2005 10:28:00 +0000</pubDate>
		<guid isPermaLink="false">/blogs/david.hayden/archive/2005/03/02/56345.aspx#comment-24</guid>
		<description><![CDATA[First, thanks for the great stuff every day David.&lt;br&gt;&lt;br&gt;Would you use this method for setting storage in an ASP.NET application over the web.config file? If so, why? Advantages/disadvantages?]]></description>
		<content:encoded><![CDATA[<p>First, thanks for the great stuff every day David.</p>
<p>Would you use this method for setting storage in an ASP.NET application over the web.config file? If so, why? Advantages/disadvantages?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: David Hayden</title>
		<link>http://codebetter.com/davidhayden/2005/03/02/enterprise-library-configuration-application-block-patterns-and-practices/#comment-23</link>
		<dc:creator>David Hayden</dc:creator>
		<pubDate>Thu, 03 Mar 2005 11:57:00 +0000</pubDate>
		<guid isPermaLink="false">/blogs/david.hayden/archive/2005/03/02/56345.aspx#comment-23</guid>
		<description><![CDATA[You&#039;re absolutely right, Sam. If you plan on always persisting your objects to XML, then certainly the Configuration Application Block is overkill and we can build a similar solution that requires less configuration settings and can output less XML.&lt;br&gt;&lt;br&gt;The application block provides a bit more functionality, however, than what I have mentioned. The &quot;Encrypt&quot; attribute is necessary, because you can actually specify and create your own encryption algorithms. I assume they would need this attribute to know when to encrypt and decrypt the information.&lt;br&gt;&lt;br&gt;The application block also allows you to create and specify other storage providers and data transformers.  It happens to come with XML-based solutions now, but you can certainly roll your own solutions to work with a database, etc.  The hope is that others will also roll their own solutions and we could share efforts.  The code in your application would stay the same and all you would do is make modifications to the config file specifying the new storage providers and data transformers.&lt;br&gt;&lt;br&gt;The application block will also fire off events if changes occur to the underlying storage provider so you can reload any changes in your application.&lt;br&gt;&lt;br&gt;Then you have the warm-and-fuzzy benefits that may or may not interest some people.  Such as the fact that the solution is community supported and thus will have bug fixes and come out with new enhancements as time goes on (we hope!).  From an employer&#039;s perspective, it also makes it easier to swap out developers and contract out work if code isn&#039;t so much developer or company specific, but more standard in nature.&lt;br&gt;&lt;br&gt;All-in-all, however, your comments are valid.  Sometimes these application blocks can be overkill and if one has a good solution already in-house, this may not be the way to go.  However, for those people who don&#039;t have a solution and can&#039;t or don&#039;t have time to write a solution themselves, it took me all of about 30 minutes to get this running.]]></description>
		<content:encoded><![CDATA[<p>You&#8217;re absolutely right, Sam. If you plan on always persisting your objects to XML, then certainly the Configuration Application Block is overkill and we can build a similar solution that requires less configuration settings and can output less XML.</p>
<p>The application block provides a bit more functionality, however, than what I have mentioned. The &quot;Encrypt&quot; attribute is necessary, because you can actually specify and create your own encryption algorithms. I assume they would need this attribute to know when to encrypt and decrypt the information.</p>
<p>The application block also allows you to create and specify other storage providers and data transformers.  It happens to come with XML-based solutions now, but you can certainly roll your own solutions to work with a database, etc.  The hope is that others will also roll their own solutions and we could share efforts.  The code in your application would stay the same and all you would do is make modifications to the config file specifying the new storage providers and data transformers.</p>
<p>The application block will also fire off events if changes occur to the underlying storage provider so you can reload any changes in your application.</p>
<p>Then you have the warm-and-fuzzy benefits that may or may not interest some people.  Such as the fact that the solution is community supported and thus will have bug fixes and come out with new enhancements as time goes on (we hope!).  From an employer&#8217;s perspective, it also makes it easier to swap out developers and contract out work if code isn&#8217;t so much developer or company specific, but more standard in nature.</p>
<p>All-in-all, however, your comments are valid.  Sometimes these application blocks can be overkill and if one has a good solution already in-house, this may not be the way to go.  However, for those people who don&#8217;t have a solution and can&#8217;t or don&#8217;t have time to write a solution themselves, it took me all of about 30 minutes to get this running.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sam</title>
		<link>http://codebetter.com/davidhayden/2005/03/02/enterprise-library-configuration-application-block-patterns-and-practices/#comment-22</link>
		<dc:creator>Sam</dc:creator>
		<pubDate>Thu, 03 Mar 2005 02:02:00 +0000</pubDate>
		<guid isPermaLink="false">/blogs/david.hayden/archive/2005/03/02/56345.aspx#comment-22</guid>
		<description><![CDATA[Ok, that was kinda a crappy comment, but I was leaving work. :)&lt;br&gt;&lt;br&gt;What don&#039;t I like about this? Well, it really has nothing to do with configuration, so I think the name is misleading. Serialization can get ugly pretty fast for configuration files though. No defaults. Look at the encrypt attribute for example. Why does that even need to be there?&lt;br&gt;&lt;br&gt;Instead you could write an XmlActivator that takes in an XmlDocument and returns you an instance based on Type specified in the document. Basically your document would look pretty much like sitesettings.config, except with the root tag have the type attribute. Then you can get rid of the xmlSerializerSection and SiteSettings sub elements. Like so: (here&#039;s hopin&#039; this works)&lt;br&gt;&lt;br&gt;&lt;SiteSettings type=&quot;SiteSettings, configtest&quot;&gt;&lt;br&gt;    &lt;Name&gt;DavidHayden.com&lt;/Name&gt;&lt;br&gt;    &lt;Url&gt;&lt;a target=&quot;_new&quot; href=&quot;http://www.davidhayden.com/&lt;/Url&gt;&quot;&gt;http://www.davidhayden.com/&lt;/Url&gt;&lt;/a&gt;&lt;br&gt;    &lt;EmailAddress&gt;nospam@nospam.com&lt;/EmailAddress&gt;&lt;br&gt;&lt;/SiteSettings&gt;&lt;br&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br&gt;&lt;br&gt;You pass this into your XmlActivator, it parses it out (in a version a friend recently wrote you could also specify the Type for each parameter, or it would default to string if the attribute was not present though this could also be inferred from the parameter Type through reflection), and uses System.Activator to give you an instance.&lt;br&gt;&lt;br&gt;This doesn&#039;t do the same thing though you might say. You&#039;re right. If you want to be able to specify a different xmldocument through app.config, you&#039;re also going to need to write a configurationSectionHandler. There lots of examples on the web, and it&#039;s actually a whole lot easier than I thought before I wrote one, so don&#039;t worry, if I can do it anyone can. :) Instead of all that nasty markup though, you only need your section element specifying the handler to use, and the element named in the section element. That element only needs to contain two attributes: A name for the instance, and the path to the xmldocument. Sure you could add encryption and all that, but I&#039;d recommend you do it manually. Parsing Xml is actually really easy, and it lets you do things like default to no encryption if the attribute is missing.&lt;br&gt;&lt;br&gt;With this sort of design, for the same example, your xml files would be half the size, and you&#039;d get the same functionality and more.&lt;br&gt;&lt;br&gt;The config app block could allow other stuff I&#039;m not seeing here, so this is just based on what I see. I&#039;m not familiar with it personally. But from the example it looks like the hard way to do it.&lt;br&gt;&lt;br&gt;That&#039;s my 2c anyways. :)]]></description>
		<content:encoded><![CDATA[<p>Ok, that was kinda a crappy comment, but I was leaving work. <img src='http://codebetter.com/davidhayden/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>What don&#8217;t I like about this? Well, it really has nothing to do with configuration, so I think the name is misleading. Serialization can get ugly pretty fast for configuration files though. No defaults. Look at the encrypt attribute for example. Why does that even need to be there?</p>
<p>Instead you could write an XmlActivator that takes in an XmlDocument and returns you an instance based on Type specified in the document. Basically your document would look pretty much like sitesettings.config, except with the root tag have the type attribute. Then you can get rid of the xmlSerializerSection and SiteSettings sub elements. Like so: (here&#8217;s hopin&#8217; this works)</p>
<p>&amp;lt;SiteSettings type=&quot;SiteSettings, configtest&quot;&amp;gt;<br />
<br />    &amp;lt;Name&amp;gt;DavidHayden.com&amp;lt;/Name&amp;gt;<br />
<br />    &amp;lt;Url&amp;gt;<a target="_new" href="http://www.davidhayden.com/&amp;lt;/Url&amp;gt;"></a><a href="http://www.davidhayden.com/&#038;lt;/Url&#038;gt" rel="nofollow">http://www.davidhayden.com/&#038;lt;/Url&#038;gt</a>;<br />
<br />    &amp;lt;EmailAddress&amp;gt;nospam@nospam.com&amp;lt;/EmailAddress&amp;gt;<br />
<br />&amp;lt;/SiteSettings&amp;gt;<br />
<br />&amp;lt;/code&amp;gt;&amp;lt;/pre&amp;gt;</p>
<p>You pass this into your XmlActivator, it parses it out (in a version a friend recently wrote you could also specify the Type for each parameter, or it would default to string if the attribute was not present though this could also be inferred from the parameter Type through reflection), and uses System.Activator to give you an instance.</p>
<p>This doesn&#8217;t do the same thing though you might say. You&#8217;re right. If you want to be able to specify a different xmldocument through app.config, you&#8217;re also going to need to write a configurationSectionHandler. There lots of examples on the web, and it&#8217;s actually a whole lot easier than I thought before I wrote one, so don&#8217;t worry, if I can do it anyone can. <img src='http://codebetter.com/davidhayden/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  Instead of all that nasty markup though, you only need your section element specifying the handler to use, and the element named in the section element. That element only needs to contain two attributes: A name for the instance, and the path to the xmldocument. Sure you could add encryption and all that, but I&#8217;d recommend you do it manually. Parsing Xml is actually really easy, and it lets you do things like default to no encryption if the attribute is missing.</p>
<p>With this sort of design, for the same example, your xml files would be half the size, and you&#8217;d get the same functionality and more.</p>
<p>The config app block could allow other stuff I&#8217;m not seeing here, so this is just based on what I see. I&#8217;m not familiar with it personally. But from the example it looks like the hard way to do it.</p>
<p>That&#8217;s my 2c anyways. <img src='http://codebetter.com/davidhayden/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sam</title>
		<link>http://codebetter.com/davidhayden/2005/03/02/enterprise-library-configuration-application-block-patterns-and-practices/#comment-21</link>
		<dc:creator>Sam</dc:creator>
		<pubDate>Wed, 02 Mar 2005 20:08:00 +0000</pubDate>
		<guid isPermaLink="false">/blogs/david.hayden/archive/2005/03/02/56345.aspx#comment-21</guid>
		<description><![CDATA[Wow that&#039;s ugly. :)]]></description>
		<content:encoded><![CDATA[<p>Wow that&#8217;s ugly. <img src='http://codebetter.com/davidhayden/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
</channel>
</rss>
