<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://footheory.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Daily Devscovery</title><link>http://footheory.com/blogs/rupendra/default.aspx</link><description /><dc:language>en</dc:language><generator>CommunityServer 2007 SP2 (Debug Build: 20611.960)</generator><item><title>Custom Application Block Development with Enterprise Library 3.0</title><link>http://footheory.com/blogs/rupendra/archive/2007/07/11/custom-application-block-development-with-enterprise-library-3-0.aspx</link><pubDate>Wed, 11 Jul 2007 15:24:16 GMT</pubDate><guid isPermaLink="false">9ce7e6ef-4587-4f0e-939d-3f75f3a8ddfc:119</guid><dc:creator>Rupendra Dhillon</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://footheory.com/blogs/rupendra/rsscomments.aspx?PostID=119</wfw:commentRss><comments>http://footheory.com/blogs/rupendra/archive/2007/07/11/custom-application-block-development-with-enterprise-library-3-0.aspx#comments</comments><description>&lt;p align="left"&gt;&lt;span style="font-size:85%;font-family:arial;"&gt;I would like to start with my full respect to anyone who has been working on developing Custom Application Configuration block. No, its not the toughest thing to do in this world. But it is one which can make you pull out your hair and kick your system and do wired stuff. I have survived the process and I totally acknowledge those who have. Why ? lets start. And oh, by the way I want to mention that I was feeling happy/confidant/kick-ass awesome before I started to work on this block because I had already completed two custom application configuration blocks (which granted were simple - just key-value pairs) using the Ent. Lib. 3.0 Application Block Software Factory (ABSF) tool. I thought, "Oh yeah !!! This is my baby !!!"&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size:85%;font-family:arial;"&gt;Some facts about ABSF that I would like everyone to know. Please do read because if you don't you will face dire consequences on the path of creating a new custom application configuration block. ABSF is a software factory from the Patterns and Practices team to design custom application configuration blocks. Wow !!! that made everything so easy but from the fact that:&lt;/span&gt;&lt;/p&gt;&lt;b&gt;&lt;u&gt; &lt;p&gt;&lt;span style="font-size:85%;font-family:arial;"&gt;File Names&lt;/span&gt;&lt;/p&gt;&lt;/b&gt;&lt;/u&gt; &lt;p&gt;&lt;span style="font-size:85%;font-family:arial;"&gt;It creates file names so long that you will be scrolling forever to see the end. And I can almost guarantee that if you are a developer like me who wants everything neatly arranged in their folders and hence end up being like four levels deep when you start your designer project: buddy you are already in trouble. How about a taste of it ? How does the following name sound ? &lt;/span&gt;&lt;/p&gt;&lt;b&gt; &lt;p align="left"&gt;&lt;span style="font-size:85%;font-family:arial;"&gt;"C:\Projects\MTFGP 2007 Pilot \POC\WebServiceProxy\Configuration\Application Block\Unit Tests\MTFGP.Web.Services.Proxy.Configuration.Configuration.Design.Tests\&amp;nbsp;bin\Debug\MTFGP.Web.Services.Proxy.Configuration.Configuration.Design.Tests.dll.CodeAnalysisLog.xml"&lt;/span&gt;&lt;/p&gt;&lt;/b&gt; &lt;p&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:arial;"&gt;Tingly ? Well what's wrong with it !!! Its totally fine and it so totally describes what I want to build. But oh see its just 259 characters long which is just above the longest path any windows operating system will support. Hmm... that shouldn't be any problem because it should be me who should cut short the names of my namespaces to be like MTFGP.Web.Serv.Proxy.Config.Config.Design.Tests. Oh come on! what am I talking about... that was easy.&lt;/span&gt;&lt;/p&gt;&lt;/span&gt;&lt;b&gt;&lt;u&gt; &lt;p&gt;&lt;span style="font-size:85%;font-family:arial;"&gt;Project Structure&lt;/span&gt;&lt;/p&gt;&lt;/b&gt;&lt;/u&gt; &lt;p&gt;&lt;span style="font-size:85%;font-family:arial;"&gt;Oh I love structuring my projects. Structuring makes for great reusability and I am all for it. So lets look at the project structure adopted by the ABSF recipe. &lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size:85%;font-family:arial;"&gt;1. I create an application settings project lets say with the name, "&lt;b&gt;MyNamespace.MyModule.Configuration&lt;/b&gt;" in the directory "&lt;b&gt;C:\Projects\MyModule&lt;/b&gt;" (I chose this directory for convenience and some other realistic implementation might very well be deeper)&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family:arial;"&gt;Image&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size:85%;font-family:arial;"&gt;&lt;a href="http://picasaweb.google.com/rupendradhillon/CustomApplicationBlockDevelopmentWithEnterpriseLibrary30/photo#5085799704500749554"&gt;&lt;img height="150" src="http://lh4.google.com/rupendradhillon/RpRj4rGNxPI/AAAAAAAAAZo/AeBteyigIps/01.JPG" width="240"&gt;&lt;/a&gt; &lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size:85%;font-family:arial;"&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size:85%;font-family:arial;"&gt;2. And then I enter the same name on the recipe form (shown below)&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size:85%;font-family:arial;"&gt;&lt;a href="http://picasaweb.google.com/rupendradhillon/CustomApplicationBlockDevelopmentWithEnterpriseLibrary30/photo#5085799708795716866"&gt;&lt;img height="144" src="http://lh5.google.com/rupendradhillon/RpRj47GNxQI/AAAAAAAAAZw/tQOEuuiYNr4/02.jpg" width="240"&gt;&lt;/a&gt; &lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size:85%;font-family:arial;"&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size:85%;font-family:arial;"&gt;2.1. And walla !!! I get the message from the gods themselves !!!!&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size:85%;font-family:arial;"&gt;&lt;a href="http://picasaweb.google.com/rupendradhillon/CustomApplicationBlockDevelopmentWithEnterpriseLibrary30/photo#5085799708795716882"&gt;&lt;img height="43" src="http://lh5.google.com/rupendradhillon/RpRj47GNxRI/AAAAAAAAAZ4/4UiYWTeut_Y/03.jpg" width="240"&gt;&lt;/a&gt; &lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size:85%;font-family:arial;"&gt;&lt;a href="http://picasaweb.google.com/rupendradhillon/CustomApplicationBlockDevelopmentWithEnterpriseLibrary30/photo#5085799713090684194"&gt;&lt;img height="173" src="http://lh6.google.com/rupendradhillon/RpRj5LGNxSI/AAAAAAAAAaA/3tOWfHvrXTA/04.jpg" width="240"&gt;&lt;/a&gt; &lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size:85%;font-family:arial;"&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size:85%;font-family:arial;"&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size:85%;font-family:arial;"&gt;The detail says&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size:85%;font-family:arial;"&gt;Microsoft.Practices.RecipeFramework.RecipeExecutionException: An exception occurred during the binding of reference or execution of recipe CreateApplicationBlock. Error was: The following arguments are required and don't have values: DesignTimeProject, DesignTimeTestProject, DesignTimeResources. Can't continue execution.. &lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size:85%;font-family:arial;"&gt;You can remove the reference to this recipe through the Guidance Package Manager.&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size:85%;font-family:arial;"&gt;at Microsoft.Practices.RecipeFramework.Recipe.ThrowIfRequiredArgumentsAreNull(IDictionaryService arguments)&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size:85%;font-family:arial;"&gt;at Microsoft.Practices.RecipeFramework.Recipe.Execute(Boolean allowSuspend)&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size:85%;font-family:arial;"&gt;at Microsoft.Practices.RecipeFramework.GuidancePackage.Execute(String recipe, IAssetReference reference, IDictionary arguments)&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size:85%;font-family:arial;"&gt;at Microsoft.Practices.RecipeFramework.GuidancePackage.ExecuteFromTemplate(String recipe, IDictionary arguments)&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size:85%;font-family:arial;"&gt;at Microsoft.Practices.RecipeFramework.VisualStudio.Templates.UnfoldTemplate.ExecuteRecipe(Boolean executeActions)&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size:85%;font-family:arial;"&gt;at Microsoft.Practices.RecipeFramework.VisualStudio.Templates.UnfoldTemplate.RunFinished()&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size:85%;font-family:arial;"&gt;This exception is brought to me by the all powerful Visual Studio and I know I have screwed up.&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size:85%;font-family:arial;"&gt;3. So what do I do now. Well I create a directory called "1" on my root to create my solution. (Can't get smaller than that) and repeat the steps 1 and 2 and holy cow !!! the same thing !!!&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;a href="http://picasaweb.google.com/rupendradhillon/CustomApplicationBlockDevelopmentWithEnterpriseLibrary30/photo#5085799717385651506"&gt;&lt;img height="42" src="http://lh3.google.com/rupendradhillon/RpRj5bGNxTI/AAAAAAAAAaI/ir1GfA89fsQ/05.jpg" width="240"&gt;&lt;/a&gt; &lt;/p&gt; &lt;p&gt;&lt;span style="font-size:85%;font-family:arial;"&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family:arial;"&gt;&lt;span style="font-size:85%;"&gt;4. Umm... I don't have any other option other than to shorten my project name because in that's the only variable in "&lt;b&gt;$ProjectName$.Configuration.Design.Tests&lt;/b&gt;". Well ok, I am going to call it &lt;strike&gt;2&lt;/strike&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt; &lt;strike&gt;Bob&lt;/strike&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt; "MyModule". Ok lets try again. Woot !!! "MyModule" Worked. here is how the solution looks in Visual Studio and on disk.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;a href="http://picasaweb.google.com/rupendradhillon/CustomApplicationBlockDevelopmentWithEnterpriseLibrary30/photo#5085799721680618818"&gt;&lt;img height="152" src="http://lh4.google.com/rupendradhillon/RpRj5rGNxUI/AAAAAAAAAaQ/r6wyv0P_VmI/06.jpg" width="240"&gt;&lt;/a&gt; &lt;/p&gt; &lt;p&gt;&lt;span style="font-size:85%;font-family:arial;"&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size:85%;font-family:arial;"&gt;Hmm... what I have is a structure which generally doesn't fit in how I started thinking my projects structure would be. If we look at the file structure then we notice that the solution is placed inside the "C:\1\MyModule" directory. There are "&lt;b&gt;Application Block&lt;/b&gt;" and "&lt;b&gt;Lib&lt;/b&gt;" folders to segregate the code and the output, but I won't be using it because I have my own bin into which I want this solution to build but this is fine. Inside the "&lt;b&gt;Application Block&lt;/b&gt;" Folder we see the sub-folders "Design", "MyModule" and "Unit Tests". I am somehow not very comfortable with my Unit Tests being at the same level as the project since now I have been trying to follow the &lt;a href="http://www.codeplex.com/VSTSGuidance"&gt;VSTS project structuring guidance&lt;/a&gt; and &lt;a href="http://www.codeplex.com/VSTSGuidance/Wiki/View.aspx?title=How%20To%3a%20Structure%20Your%20Source%20Control%20Folders%20in%20Team%20Foundation%20Server&amp;amp;referringTitle=How%20Tos"&gt;How To: Structure Your Source Control Folders In Team Foundation Server&lt;/a&gt; give a very clear and rational approach to arrange your projects. So according to the VSTS guidance I rearrange my project. It requires some manual changes to the .sln file and I would advise please learn how to do it before you try that. Now it looks as shown below.&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size:85%;font-family:arial;"&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size:85%;font-family:arial;"&gt;&lt;a href="http://picasaweb.google.com/rupendradhillon/CustomApplicationBlockDevelopmentWithEnterpriseLibrary30/photo#5085799725975586130"&gt;&lt;img height="65" src="http://lh5.google.com/rupendradhillon/RpRj57GNxVI/AAAAAAAAAaY/JI6fG4dud9A/07.jpg" width="240"&gt;&lt;/a&gt; &lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size:85%;font-family:arial;"&gt;I did away with the "Lib" folder too and since I will be building to my "bin" folder somewhere in the depths of my file-system. Ok so if you have a project that is simple enough you can start with this skeleton and add more stuff on to it. There are some &lt;a href="http://blogs.msdn.com/tomholl/archive/2007/04/10/enterprise-library-the-videos.aspx"&gt;videos&lt;/a&gt; available that show you how to make a simple application configuration block. I think they are a great place to start from because I did not know anything about developing configuration blocks when I started and these videos and the forums really helped me. Everyone tries to answer and help as much as possible and make Ent. Lib. development a truly community effort. Cheers to the P&amp;amp;P team !!!&lt;/span&gt;&lt;/p&gt;&lt;b&gt;&lt;u&gt; &lt;p&gt;&lt;span style="font-size:85%;font-family:arial;"&gt;A lot of files too fast !!!&lt;/span&gt;&lt;/p&gt;&lt;/b&gt;&lt;/u&gt; &lt;p&gt;&lt;span style="font-family:arial;"&gt;&lt;span style="font-size:85%;"&gt;Another thing that a n00b to the application configuration development would have to learn is to comprehend the fact that you would be looking at a lot of files and that too being created in a wink of the eye. When you work on the designer project you add different parts one by one using recipes. These recipes can create new files/restructure your project (add new partial classes)/Change existing files in the order of 5-15 files in a go all over your solution (multi-project changes). This is something I had no experience with when I started and I would hold my breath when I would see my solution doing all the gymnastics that it does when it goes through a recipe. &lt;b&gt;You would have to get used to it&lt;/b&gt;. My suggestion: Try to get your hands wet on &lt;strike&gt;a few&lt;/strike&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt; &lt;strike&gt;some&lt;/strike&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt; many sample projects first and carefully look at what each recipe that you run does to your solution. This is so important because of two reasons.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size:85%;font-family:arial;"&gt;1. You don't want to be looking all over the place when you make a change because you want to get to the real guts as soon as possible.&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size:85%;font-family:arial;"&gt;2. You want to know exactly what changed because you are going to do this in a real solution in some time.&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size:85%;font-family:arial;"&gt;3. There is no "Undo this recipe" !!! (Can I have a "I am really scared" smiley here ?)&lt;/span&gt;&lt;/p&gt;&lt;b&gt;&lt;u&gt; &lt;p&gt;&lt;span style="font-size:85%;font-family:arial;"&gt;References&lt;/span&gt;&lt;/p&gt;&lt;/b&gt;&lt;/u&gt; &lt;p&gt;&lt;span style="font-size:85%;font-family:arial;"&gt;Many who have worked on Ent. Lib. 3.0 know that it ships with two sets of binaries: Strongly named (in your Program Files directory) and unsigned (in your Ent. Lib. Source installation folder). When you run an recipe it creates a lot of files and a lot of references. All these references to Microsoft.Practices.* assemblies point to the Microsoft strongly named assemblies. So if you are have strongly named the Ent. Lib. assemblies using your own key then you have to take the trouble of removing these references and replacing them with references to your own strongly named binaries.&lt;/span&gt;&lt;/p&gt;&lt;b&gt;&lt;u&gt; &lt;p&gt;&lt;span style="font-size:85%;font-family:arial;"&gt;Complex Configuration Application Blocks&lt;/span&gt;&lt;/p&gt;&lt;/b&gt;&lt;/u&gt; &lt;p&gt;&lt;span style="font-size:85%;font-family:arial;"&gt;This time my challenge was a bit different. The configuration block that I had to develop had to depict the following hierarchy for an auditing piece.&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size:85%;font-family:arial;"&gt;Main Block Node =(can/cannot have)=(multiple)=&amp;gt; Entities (which is collection&amp;lt;Entity&amp;gt;)&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size:85%;font-family:arial;"&gt;Entity =(has)=&amp;gt; Entity Name&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size:85%;font-family:arial;"&gt;Entity =(can have)=(multiple)=&amp;gt; Properties (which is collection&amp;lt;Property&amp;gt;)&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size:85%;font-family:arial;"&gt;Property =(has)=&amp;gt; Property Name&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size:85%;font-family:arial;"&gt;Property =(can have)=(multiple)=&amp;gt; Mappings to other Systems (which is collection&amp;lt;Mapping to other system&amp;gt;)&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size:85%;font-family:arial;"&gt;Mapping to other system =(has)=&amp;gt; System (which is an Enumeration)&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size:85%;font-family:arial;"&gt;Mapping to other system =(has)=&amp;gt; Property Name in other system&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size:85%;font-family:arial;"&gt;This was a fairly complex application block and I didn't know what to do and where to start from at this time. I realized that there are many things that I need to take out of the general mix of all these files I get for free when I use the ABSF. I cut short a few, a few more and that way I came down to the bare minimum I needed. These usually were partial classes of &lt;span style="color:#2b91af;"&gt;ApplicationBlockSettings&lt;/span&gt; class and classes like &lt;span style="color:#2b91af;"&gt;AuditingProviderDataRetriever&lt;/span&gt; implementing &lt;span style="color:#2b91af;"&gt;IConfigurationNameMapper&lt;/span&gt; and types like &lt;span style="color:#2b91af;"&gt;CustomAuditingProviderData &lt;/span&gt;implementing some of my classes &lt;span style="color:#2b91af;"&gt;AuditingProviderData&lt;/span&gt; and &lt;span style="color:#2b91af;"&gt;IHelperAssistedCustomConfigurationData&lt;/span&gt;&amp;lt;&lt;span style="color:#2b91af;"&gt;CustomAuditingProviderData&lt;/span&gt;&amp;gt; which essentially brings in the ObjectBuilder block into picture. It also used attributes usage which looked like [&lt;span style="color:#2b91af;"&gt;Assembler&lt;/span&gt;(&lt;span style="color:#0000ff;"&gt;typeof&lt;/span&gt;(&lt;span style="color:#2b91af;"&gt;CustomProviderAssembler&lt;/span&gt;&amp;lt;&lt;span style="color:#2b91af;"&gt;IAuditingProvider&lt;/span&gt;, &lt;span style="color:#2b91af;"&gt;AuditingProviderData&lt;/span&gt;, &lt;span style="color:#2b91af;"&gt;CustomAuditingProviderData&lt;/span&gt;&amp;gt;))] into picture which is required for the ObjectBuilder to figure out what assembler is required to create a runtime instance of a type correctly. It was all ok till the time I was working with simple application blocks but with this kind of a project, using object builder when I had no need for any kind of object building policy looked like a lot of work for nothing. So I decided to work with the bare minimum.&lt;/span&gt;&lt;/p&gt;&lt;b&gt;&lt;/b&gt; &lt;p&gt;&lt;span style="font-size:85%;font-family:arial;"&gt;I am not going to write the whole code here since I intend this document to be a guidance for someone who wants to understand the realities of working with the application block. The details what methods to implement in the classes listed below would be in the same spirit as done by the ABSF recipes so to get a better idea one would have to play with it for a while and then use a sample block as a reference on what all methods to implement and how to do that. So the config block I made ended up with the following components. &lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size:85%;font-family:arial;"&gt;1. A data class for the root node: &lt;/span&gt;&lt;/p&gt;  &lt;b&gt; &lt;p&gt;&lt;span style="font-size:85%;font-family:arial;"&gt;Derives out of the &lt;/span&gt;&lt;/b&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:arial;"&gt;&lt;span style="color:#2b91af;"&gt;SerializableConfigurationSection&lt;/span&gt;&lt;b&gt; class. &lt;/p&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt; &lt;p&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:arial;"&gt;Has methods like &lt;span style="color:#2b91af;"&gt;AuditMapConfigBlock&lt;/span&gt; GetConfigSettings(&lt;span style="color:#2b91af;"&gt;IConfigurationSource&lt;/span&gt; configurationSource) and &lt;span style="color:#2b91af;"&gt;AuditMapConfigBlock&lt;/span&gt; GetConfigSettings()&lt;/span&gt;&lt;/p&gt;&lt;/span&gt; &lt;p&gt;&lt;span style="font-size:85%;font-family:arial;"&gt;Can have members which hold data.&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size:85%;font-family:arial;"&gt;2. A node class for the root node: &lt;/span&gt;&lt;/p&gt;  &lt;b&gt; &lt;p&gt;&lt;span style="font-size:85%;font-family:arial;"&gt;Derives out of the &lt;/span&gt;&lt;/b&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:arial;"&gt;&lt;span style="color:#2b91af;"&gt;ConfigurationNode&lt;/span&gt; &lt;/span&gt;&lt;/span&gt;&lt;b&gt;&lt;span style="font-size:85%;font-family:arial;"&gt;class.&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size:85%;font-family:arial;"&gt;This class should not have any members that hold data.&lt;/span&gt;&lt;/b&gt;&lt;span style="font-size:85%;font-family:arial;"&gt; If this class has any data then it will have problems while saving settings to the config file for the second time (e.g. you press save, change something and again press save)&lt;/span&gt;&lt;/p&gt;&lt;b&gt; &lt;p&gt;&lt;span style="font-size:85%;font-family:arial;"&gt;Make sure you override the Name property.&lt;/span&gt;&lt;/p&gt;&lt;/b&gt; &lt;p&gt;&lt;span style="font-size:85%;font-family:arial;"&gt;3. A data class for every node in the hierarchy,&lt;/span&gt;&lt;/p&gt;  &lt;b&gt; &lt;p&gt;&lt;span style="font-size:85%;font-family:arial;"&gt;Derives out of the &lt;/span&gt;&lt;/b&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:arial;"&gt;&lt;span style="color:#2b91af;"&gt;NamedConfigurationElement&lt;/span&gt;&lt;b&gt; class&lt;/b&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size:85%;font-family:arial;"&gt;Can have data members.&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size:85%;font-family:arial;"&gt;4. A node class every node in the heirarchy.&lt;/span&gt;&lt;/p&gt;  &lt;b&gt; &lt;p&gt;&lt;span style="font-size:85%;font-family:arial;"&gt;Derives out of the &lt;/span&gt;&lt;/b&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:arial;"&gt;&lt;span style="color:#2b91af;"&gt;ConfigurationNode&lt;/span&gt;&lt;b&gt; class&lt;/p&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt; &lt;p&gt;&lt;span style="font-size:85%;font-family:arial;"&gt;Has a private members of the type of its data class.&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size:85%;font-family:arial;"&gt;Exposes the properties of the private member as its public properties.&lt;/span&gt;&lt;/p&gt;&lt;b&gt; &lt;p&gt;&lt;span style="font-size:85%;font-family:arial;"&gt;Make sure you override the Name property.&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size:85%;font-family:arial;"&gt;Make sure you update/change the name property when one of the properties of the node (in my case say the Entity Name) changes.&lt;/span&gt;&lt;/b&gt;&lt;span style="font-size:85%;font-family:arial;"&gt; If this is not done then during save there will be multiple nodes with no names (string.empty) and that will cause problems.&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:arial;"&gt;5. A class that will take the settings from the config file (cast to the data class object for the root node) and will make a complete tree out of it. In my case it was called &lt;span style="color:#2b91af;"&gt;AuditMapConfigBlockNodeBuilder&lt;/span&gt; and derives from &lt;span style="color:#2b91af;"&gt;NodeBuilder &lt;/p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt; &lt;p&gt;&lt;span style="font-size:85%;font-family:arial;"&gt;6. A class that will take a complete tree starting from the root node and convert it to an data object for that node that can be serialized to the config file. That is why the data class for the root node needs to derive out of the &lt;span style="color:#2b91af;"&gt;SerializableConfigurationSection&lt;/span&gt;&lt;b&gt; &lt;/b&gt;class.&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size:85%;font-family:arial;"&gt;7. A class that will register for every node what kind of commands (mouse actions/keyboard actions) are available for every node. it derives out of the &lt;span style="color:#2b91af;"&gt;CommandRegistrar&lt;/span&gt; class.&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size:85%;font-family:arial;"&gt;8. A class that will be queried by the Designer tool and the framework for any of its needs related to your config block, weather it be making the class in step number 7 register the commands for the different nodes or making nodes out of settings in config file or the opposite. It will be called the DesignManager and it derives from &lt;span style="color:#2b91af;"&gt;ConfigurationDesignManager&lt;/span&gt; class.&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size:85%;font-family:arial;"&gt;There are some important points that I would like to list here that might save someone some time.&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size:85%;font-family:arial;"&gt;1. Make sure that all the custom properties of the data classes that you want to see being read and written from and to the config file are being saved to the property bag provided in the &lt;span style="color:#2b91af;"&gt;NamedConfigurationElement&lt;/span&gt;&lt;b&gt; &lt;/b&gt;base class. Only the properties that have been put in the property bag will be written to the config file. e.g. &lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family:arial;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="color:#0000ff;"&gt;private&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;const&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;string&lt;/span&gt; m_EntityNameProperty = &lt;span style="color:#a31515;"&gt;"EntityName"&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family:arial;"&gt;&lt;span style="font-size:85%;"&gt;[&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="color:#2b91af;"&gt;ConfigurationProperty&lt;/span&gt;(m_EntityNameProperty, IsRequired = &lt;span style="color:#0000ff;"&gt;true&lt;/span&gt;)]&lt;/p&gt;&lt;/span&gt;&lt;/span&gt; &lt;p&gt;&lt;span style="font-family:arial;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;string&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt; EntityName&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size:85%;font-family:arial;"&gt;{&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family:arial;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="color:#0000ff;"&gt;get&lt;/span&gt; { &lt;span style="color:#0000ff;"&gt;return&lt;/span&gt; (&lt;span style="color:#0000ff;"&gt;string&lt;/span&gt;)&lt;span style="color:#0000ff;"&gt;this&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;[m_EntityNameProperty]; }&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family:arial;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="color:#0000ff;"&gt;set&lt;/span&gt; { &lt;span style="color:#0000ff;"&gt;this&lt;/span&gt;[m_EntityNameProperty] = &lt;span style="color:#0000ff;"&gt;value&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;; }&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size:85%;font-family:arial;"&gt;}&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size:85%;font-family:arial;"&gt;2. To make sure your application block gets loaded into the Ent. Lib. Config. tool place the assemblies for your blocks into the same directory as the config. tool.&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size:85%;font-family:arial;"&gt;3. In the design project DO NOT FORGET to mark the assembly with the following attribute. Without this attribute the Enterprise Library designer will fail to load your assembly when it starts up.&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family:arial;"&gt;&lt;span style="font-size:85%;"&gt;[assembly: &lt;span style="color:#2b91af;"&gt;ConfigurationDesignManager&lt;/span&gt;(&lt;span style="color:#0000ff;"&gt;typeof&lt;/span&gt;(&lt;b&gt;&amp;lt;Your Design Manager class name here&amp;gt;&lt;/b&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;))]&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family:arial;"&gt;&lt;span style="font-size:85%;"&gt;4. Icons for the nodes can only be bmp images that are 16 pixels by 16 pixels whose build action is set to "Embedded Resource". 16 and 256 colors work fine but I have not gone to true color. Use the following attributes on top of the classes to bind the images to them. The parameter in the attribute specifies the type defined in the assembly that contains the image as an embedded resource. (Here the name of my node class was &lt;span style="color:#2b91af;"&gt;AuditMapConfigBlockNode&lt;/span&gt; and the name of the corresponding bmp file was &lt;/span&gt;&lt;span style="font-size:85%;"&gt;AuditMapConfigBlockNode.bmp.)&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family:arial;"&gt;&lt;span style="font-size:85%;"&gt;[&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="color:#2b91af;"&gt;Image&lt;/span&gt;(&lt;span style="color:#0000ff;"&gt;typeof&lt;/span&gt;(&lt;span style="color:#2b91af;"&gt;AuditMapConfigBlockNode&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;))]&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-family:arial;"&gt;&lt;span style="font-size:85%;"&gt;[&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="color:#2b91af;"&gt;SelectedImage&lt;/span&gt;(&lt;span style="color:#0000ff;"&gt;typeof&lt;/span&gt;(&lt;span style="color:#2b91af;"&gt;AuditMapConfigBlockNode&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;))]&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size:85%;font-family:arial;"&gt;5. If you put the images in a solution folder then use the correct path. Another overload of the constructors of the above shown attributes allows specifying the name of embedded resource.&lt;/span&gt;&lt;b&gt;&lt;u&gt;&lt;/p&gt;&lt;/b&gt;&lt;/u&gt; &lt;p&gt;&lt;span style="font-size:85%;font-family:arial;"&gt;I know that all this is not enough to get a complex block going but please let me know of any questions and I will try my best to answer. Hope you have a great time learning how to develop custom application configuration blocks.&lt;/span&gt;&lt;/p&gt;&lt;img src="http://footheory.com/aggbug.aspx?PostID=119" width="1" height="1"&gt;</description></item><item><title>Aplication Block Software Factory Install</title><link>http://footheory.com/blogs/rupendra/archive/2007/06/13/aplication-block-software-factory-install.aspx</link><pubDate>Wed, 13 Jun 2007 17:50:00 GMT</pubDate><guid isPermaLink="false">9ce7e6ef-4587-4f0e-939d-3f75f3a8ddfc:99</guid><dc:creator>Rupendra Dhillon</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://footheory.com/blogs/rupendra/rsscomments.aspx?PostID=99</wfw:commentRss><comments>http://footheory.com/blogs/rupendra/archive/2007/06/13/aplication-block-software-factory-install.aspx#comments</comments><description>&lt;P&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:Arial;"&gt;I have had my share of struggle when trying to install Ent. Lib 3.0 and getting Application block Software Factory (ABSF) to work. The problem: It seems at first that it doesn't even install. How am I going to work (or follow any tutorial) with something which I think is not even there on my system ??? !!! I am sure other people have had the same issue too.&lt;BR&gt;&lt;BR&gt;For people like us who happen to be experimenting with the latest&amp;nbsp;the not so much known about, things that are out there, here are some steps to keep the ABSF installation as simple as possible. Remember to follow these steps in the correct order.&lt;BR&gt;&lt;BR&gt;This assumes that you guys have either&amp;nbsp;Microsoft Visual Studio 2005 Professional SP1 or Microsoft Visual Studio 2005 Team System Developer Center SP1 (Team System is reqired to run the VSTS Unit Tests)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:Arial;"&gt;Ok, so getting ahead with the order of install.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:Arial;"&gt;&lt;BR&gt;1. Install Microsoft .Net Framework 2.0: This should also be there if you have any of the above mentioned version of VS 2005 but I somehow cared to mention.&lt;BR&gt;2. Install Guidance Automation Extensions:GAX (Look for the latest version because the &lt;EM&gt;P&amp;amp;P Team&lt;/EM&gt;&amp;nbsp;occasionally puts out new versions. For more information on GAX look &lt;A title="Guidance Automation Extensions and Toolkit: June 2006 Release" href="http://blogs.msdn.com/tomholl/archive/2006/06/24/645882.aspx" target=_blank&gt;&lt;FONT color=#800080&gt;here&lt;/FONT&gt;&lt;/A&gt;.)&lt;BR&gt;3. Install Microsoft .Net Framework .NET 3.0 (&lt;SPAN style="COLOR:#990000;"&gt;Just in case&lt;/SPAN&gt;: If anyone gets problems during the installation of .Net 3.0 please refer to &lt;A href="http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1518360&amp;amp;SiteID=1"&gt;&lt;SPAN style="COLOR:#336699;"&gt;this&lt;/SPAN&gt;&lt;/A&gt; url. Also please make sure before starting the machine in the diagnostics mode that the “Background Intelligent Transfer Service” is also turned on.)&lt;BR&gt;4. Install Enterprise Library &lt;A title="Just Released! Enterprise Library 3.0 - December 2006 CTP" href="http://blogs.msdn.com/tomholl/archive/2006/12/22/just-released-enterprise-library-3-0-december-2006-ctp.aspx"&gt;&lt;FONT color=#800080&gt;3.0&lt;/FONT&gt;&lt;/A&gt; (now &lt;A title="Enterprise Library 3.1 is released" href="http://blogs.msdn.com/tomholl/archive/2007/05/25/enterprise-library-3-1-is-released.aspx" target=_blank&gt;&lt;FONT color=#800080&gt;3.1&lt;/FONT&gt;&lt;/A&gt;): The reason why it should be done in the end is because Ent. Lib. installs support for ABSF only if it finds .Net 3.0 and GAX on your system.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;SPAN style="FONT-SIZE:10pt;FONT-FAMILY:Arial;mso-fareast-font-family:'Times New Roman';mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:AR-SA;"&gt;Happy ABSF'ing =D&lt;/SPAN&gt;&lt;img src="http://footheory.com/aggbug.aspx?PostID=99" width="1" height="1"&gt;</description><category domain="http://footheory.com/blogs/rupendra/archive/tags/GAX/default.aspx">GAX</category><category domain="http://footheory.com/blogs/rupendra/archive/tags/Development/default.aspx">Development</category><category domain="http://footheory.com/blogs/rupendra/archive/tags/Issues/default.aspx">Issues</category><category domain="http://footheory.com/blogs/rupendra/archive/tags/Application+Block+Software+Factory/default.aspx">Application Block Software Factory</category><category domain="http://footheory.com/blogs/rupendra/archive/tags/Enterprise+Library/default.aspx">Enterprise Library</category><category domain="http://footheory.com/blogs/rupendra/archive/tags/.Net+Platform/default.aspx">.Net Platform</category><category domain="http://footheory.com/blogs/rupendra/archive/tags/C_2300_/default.aspx">C#</category><category domain="http://footheory.com/blogs/rupendra/archive/tags/ABSF/default.aspx">ABSF</category></item></channel></rss>