
{"id":125,"date":"2009-01-02T20:05:34","date_gmt":"2009-01-03T01:05:34","guid":{"rendered":"http:\/\/ikriv.com:8765\/blog\/?p=125"},"modified":"2009-01-02T20:05:34","modified_gmt":"2009-01-03T01:05:34","slug":"merging-configs-wcf-and-otherwise","status":"publish","type":"post","link":"https:\/\/ikriv.com\/blog\/?p=125","title":{"rendered":"Merging Configs (WCF and otherwise)"},"content":{"rendered":"<p>Following up on the WCF config theme. Back in April I wrote a config merger for our CAB application. General scenario was as follows: we had a central &#8220;shell&#8221; application that was loading &#8220;plug-ins&#8221; based on a dynamic config file. The shell and the plug-ins were developed by different teams with different release schedules, etc.<br \/>\n<!--more--><br \/>\nEach plug-in wanted to use some <code>app.config<\/code> features, such as application settings, WCF configuration, etc. It turned out that there is no single rule for merging configs: each node should be treated individually. XML document is a tree, so merging XML documents is naturally does in a recursive fashion. We start merging root nodes: one side is the &#8220;main&#8221; document and the other is the &#8220;mix-in&#8221; document. We apply one of the three main strategies:<\/p>\n<ul>\n<li>No merge: the node may appear only in main or only in mix-in, but not in both<\/li>\n<li>Include both: if the node appears in both main and mix-in, insert the mix-in node after the main node<\/li>\n<li>True merge: merge children of the mix-in node into the main node (using no merge, include both, or true merge; different methods may be used on children of different kinds)<\/li>\n<\/ul>\n<p>There is no universal rule that would determine which method to use: e.g. &lt;appSettings> would use true merge, while its children &lt;add>, &lt;remove>, etc. would use &#8220;include both&#8221;.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Following up on the WCF config theme. Back in April I wrote a config merger for our CAB application. General scenario was as follows: we had a central &#8220;shell&#8221; application <a href=\"https:\/\/ikriv.com\/blog\/?p=125\" class=\"more-link\">[&hellip;]<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"Layout":"","footnotes":""},"categories":[3,4],"tags":[],"class_list":["entry","author-ikriv","has-more-link","post-125","post","type-post","status-publish","format-standard","category-dotnet","category-hack"],"_links":{"self":[{"href":"https:\/\/ikriv.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/125","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ikriv.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ikriv.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ikriv.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ikriv.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=125"}],"version-history":[{"count":0,"href":"https:\/\/ikriv.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/125\/revisions"}],"wp:attachment":[{"href":"https:\/\/ikriv.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=125"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ikriv.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=125"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ikriv.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=125"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}