<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://msmvps.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>Leaning Into Windows : .NET</title><link>http://msmvps.com/blogs/kathleen/archive/tags/.NET/default.aspx</link><description>Tags: .NET</description><dc:language>en</dc:language><generator>CommunityServer 2008.5 SP2 (Build: 40407.4157)</generator><item><title>MEF and Cardinality Composition Failures</title><link>http://msmvps.com/blogs/kathleen/archive/2009/07/17/mef-and-cardinality-composition-failures.aspx</link><pubDate>Fri, 17 Jul 2009 13:44:24 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1702588</guid><dc:creator>Kathleen</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/kathleen/rsscomments.aspx?PostID=1702588</wfw:commentRss><comments>http://msmvps.com/blogs/kathleen/archive/2009/07/17/mef-and-cardinality-composition-failures.aspx#comments</comments><description>&lt;p&gt;&lt;em&gt;You can check &lt;a href="http://msmvps.com/blogs/kathleen/archive/2009/07/17/a-quick-description-of-mef.aspx"&gt;here&lt;/a&gt; for a quick description of MEF&lt;/em&gt;&lt;/p&gt; &lt;p&gt;I&amp;#39;m giving a half dozen MEF talks this summer and I&amp;#39;m frequently asked &amp;quot;what happens if a part isn&amp;#39;t available&amp;quot;. The old answer was &amp;quot;the system crashes, how could it do anything else?&amp;quot; This conversation definitely deflates the upbeat mood of a MEF talk. Recently, MEF has changed, making that answer obsolete.&lt;/p&gt; &lt;p&gt;MEF is a composition container which satisfies imports by tracking down associated exports. The correct number of exports to satisfy each import is called the cardinality and can be one, zero to one or zero to many. Thus an import can fail because there are too few or too many matching exports.&lt;/p&gt; &lt;p&gt;In the MEF previews 1-5 (inclusive) and in the Visual Studio CTPs and beta1, MEF throws an exception when a failure occurs.&lt;/p&gt; &lt;p&gt;MEF Preview 6, released last Monday, introduces &amp;quot;stable composition.&amp;quot; With stable composition, the container can know about, but not expose parts. If a part fails on a cardinality rule, the MEF container remembers the part, but keeps it hidden. If additional composition occurs (such as through the Refresh method) additional attempts to fully compose the part occur. If its cardinality is fulfilled, the part becomes available for additional composition. You can think of this as &amp;quot;if a missing sub part shows up later, the containing part will become available.&amp;quot;&lt;/p&gt; &lt;p&gt;There are both good and bad aspects of this, and it definitely affects how you think of and write your MEF systems. In general, it will make MEF apps more stable. If you design a plug-in model, and the creator of a plug-in fails to properly deploy (or a confused user deletes some but not all of a plug-in via File Explorer), your system will not crash. The containing part, which would probably fail if run, doesn&amp;#39;t appear in composition. This makes your system more robust against errors that are beyond your control. It also allows the late composition strategy, although I&amp;#39;m not yet clear on good scenarios for it.&lt;/p&gt; &lt;p&gt;The down side is that you may have more challenges finding certain types of composition errors because you will not receive an exception - you need to catch the current state of the composition container. And if you don&amp;#39;t consider this behavior when writing your app, you can get officially bad behavior. &lt;/p&gt; &lt;p&gt;In a plug-in design such as the directory composition model, any part in your system can fail on a cardinality (and could previously have crashed) because all parts can be made of other parts with dependencies you don&amp;#39;t know about. &lt;/p&gt; &lt;p&gt;For example, consider creating a main menu as a part and that menu is made up of menu items and sub menus and one of the menu items cannot be composed due to a deeply nested cardinality failure. If each main menu item is a part and you import the menu items as a collection using the ImportMany attribute, you&amp;#39;re fine. Your application will simply not display the failed menu item.As deep as the nesting goes, each layer that is a collection is naturally protected because cardinality failures just remove one part from the collection. &lt;/p&gt; &lt;p&gt;If instead you create your main menu to explicitly expect a particular menu item (such as a Tools sub menu) and that menu has a required Import for a part and so on down to a point of cardinality failure, then the failure cascades up the chain. This happens because the leaf cardinality failure means that part is not available, causing a cardinality failure at the next level. In this hypothetical case, the failure cascades all the way up to the main menu which does not now exist. The application either runs without a main menu, or the application fails because the main menu is missing.&lt;/p&gt; &lt;p&gt;You can avoid this by considering the intent of each import and providing appropriate protection. Some parts are optional and your application can run just fine without them. These should either be in a collection (ImportMany in recent previews) or not required. Other parts are important, but not important enough to cause their container to fail. These can be managed via asserts, and communication with support or the user. If parts are critical to the application running, then you need to check that they exist after composition and shut down the application as gracefully as possible. &lt;/p&gt; &lt;p&gt;I think this is a good change, but at least until more patterns emerge, you need to consider what would happen if any import is not successfully satisfied. Should the containing part also fail to be composed?&lt;/p&gt; &lt;p&gt;MEF is a very sharp knife. It cuts up the tomatoes and carrots really well and we can have a dandy stew. Or we can wind up in the emergency room. Understanding MEF is important to safe MEF use. &lt;/p&gt; &lt;p&gt;&lt;em&gt;You can find more on the Preview 6 changes in &lt;a href="http://blogs.msdn.com/nblumhardt/archive/2009/07/09/mef-preview-6-available.aspx"&gt;this&lt;/a&gt; post by &lt;a href="http://blogs.msdn.com/nblumhardt/default.aspx"&gt;Nicholas Blumhardt&lt;/a&gt; who is a member of the MEF team. I&amp;#39;d like to thank Glenn Block for his discussions with me on this change. &lt;/em&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1702588" width="1" height="1"&gt;</description><category domain="http://msmvps.com/blogs/kathleen/archive/tags/.NET/default.aspx">.NET</category><category domain="http://msmvps.com/blogs/kathleen/archive/tags/MEF/default.aspx">MEF</category></item><item><title>A Quiet Conversation about DDD and Data First Design</title><link>http://msmvps.com/blogs/kathleen/archive/2009/03/07/a-quiet-conversation-about-ddd-and-data-first-design.aspx</link><pubDate>Sat, 07 Mar 2009 14:36:27 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1676322</guid><dc:creator>Kathleen</dc:creator><slash:comments>5</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/kathleen/rsscomments.aspx?PostID=1676322</wfw:commentRss><comments>http://msmvps.com/blogs/kathleen/archive/2009/03/07/a-quiet-conversation-about-ddd-and-data-first-design.aspx#comments</comments><description>&lt;p&gt;At the MVP Summit I had the pleasure to sit down at a party for some one on one time with Don Smith. I’m trying to think of my blog as a nice little corner to talk, rather than a soapbox. I want to make an share something that is not shouted from the rooftops. Eeegads, I don’t want to start another debate on this. &lt;p&gt;A few months ago, the EF team started a wiki where Ward Bell and I felt quite attacked for suggesting that DDD is not always the best approach. And thus, it is with some trepidation that I touch this topic. But today’s Database Weekly has a column on it and I really feel there’s stuff worth hearing. If you’re here in my nice intimate corner, you can hear it. &lt;p&gt;The question of whether to start with a database or a domain (business object) model makes no sense. The answer is easy: start with the one most likely to bring you success, and don’t ignore the impedance mismatch problem.  &lt;p&gt;A well structured application has a good domain model and a good (relational) database and a good strategy to cross the impedance mismatch boundary. That boundary exists because neither the domain nor the database should drive the structure of the other.  &lt;p&gt;A database might be a more successful starting point if you have good, stubborn, or available DBA’s or if your DBA’s are good analysts. If you’re a small shop – which do you build better and have you ever tried building it the other way? Database first is also often a good starting point if you have an existing database. Even if the database is bad, it contains the existing business, and it’s my belief we should never close our eyes to a way the business has already expressed itself if we can get a hold of it (it’s not in code). While we should consider available expressions of the business, we should not blindly accept any piece without exploring also exploring its problems.  &lt;p&gt;A domain might be a more successful starting point if you have good, stubborn, or available coders, or if your coders are good analysts. If you’re a small shop – which do you build better and have you ever tried building it the other way? Domain first (DDD) can also be a good starting point if you have an existing database. If you build a domain model that you constantly validate against the existing database you can base your thinking on experience while not being stuck in that experience. While we should consider available expressions of the business, we should not blindly accept any piece without exploring also exploring its problems.  &lt;p&gt;If it’s an even match, consider DDD. The issues are more subtle and getting them out of the way might be helpful to your project.  &lt;p&gt;The monumental disservice that resulted from the EF wiki (which has thankfully now died a formal death) is that this decision appeared to be a religious one or one that marked you in one camp, or perhaps to some even something about your level of coding. All of that is stupid.  &lt;p&gt;- &lt;i&gt;Do DDD or database first based on what makes sense in your specific scenario&lt;/i&gt; &lt;p&gt;- &lt;i&gt;Whichever way you start, attention to the impedance mismatch will minimize negative consequences to the other side of the boundary&lt;/i&gt; &lt;p&gt;It comes down to the obvious. It’s your team, it’s your project. Make decisions based on your reality, not dogma. Learn from the debates in our industry. Don’t pick sides and follow blindly (even my side.) &lt;p&gt;So, now we can go back to the rest of the party. If this kicks off another brawl, I suggest slipping out by the side door. &lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1676322" width="1" height="1"&gt;</description><category domain="http://msmvps.com/blogs/kathleen/archive/tags/.NET/default.aspx">.NET</category><category domain="http://msmvps.com/blogs/kathleen/archive/tags/Design/default.aspx">Design</category></item><item><title>Entity Framework Petition</title><link>http://msmvps.com/blogs/kathleen/archive/2008/06/24/entity-framework-petition.aspx</link><pubDate>Tue, 24 Jun 2008 22:44:43 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1637369</guid><dc:creator>Kathleen</dc:creator><slash:comments>12</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/kathleen/rsscomments.aspx?PostID=1637369</wfw:commentRss><comments>http://msmvps.com/blogs/kathleen/archive/2008/06/24/entity-framework-petition.aspx#comments</comments><description>&lt;p&gt;I feel I need to respond to the “&lt;a href="http://efvote.wufoo.com/forms/ado-net-entity-framework-vote-of-no-confidence/"&gt;Vote of No Confidence&lt;/a&gt;” on the Entity Framework.  &lt;p&gt;I have little interest in petitions. They are by nature backwards looking. To get a group of people to sign onto something they have to either understand it or be driven by the charisma of the leaders. In this case, I assume the first. The contents of the petition must be stable and old enough that everyone has worked out the details. That’s the case with all the technical petitions I can think of, although admittedly that’s just a handful like the VB6 petition.  &lt;p&gt;When it comes to the appalling scenario where we have at least 14 major categories of data access strategies in use in new projects today, we need the Microsoft teams to look forward and be creative in combining the best set of techniques – NOT pick one of the existing strategies and latch on to it because it came from the group that yelled the loudest.  &lt;p&gt;Entity approaches are good because they better separate the business and data sides of our middle tiers. But they are also inherently difficult and inaccessible to most programmers. Entity Framework’s goal must be to bridge this gap. That means being extremely creative in picking its battles to reach toward the real world developer – not copy a strategy that is available to that developer today and fails (the combination of NHibernate and other tools used in a specific style of development). The failure is not because NHibernate is an Open Source tool. It’s not because people don’t know about it. If it worked in the majority of shops it would burn through our industry like wildfire. Why don’t you use them? &lt;b&gt;&lt;i&gt;Because they do not fit your development environment!&lt;/i&gt;&lt;/b&gt; This is not an easy problem that someone’s solved and Microsoft is looking the other way. It’s an incredibly hard problem – how do I know? I’ve been working on occasionally novel solutions to the problems for 20 years.  &lt;p&gt;Entity Framework has issues. This is not news. It’s not even news to the Entity Framework team.  &lt;p&gt;- EF is not a failure because it doesn’t fit TDD development &lt;p&gt;- EF is not a failure because business logic goes into partial classes &lt;p&gt;- EF is not a failure because it treats data as an important part of biz objects &lt;p&gt;- EF is not a failure because it accepts that most people do data first development &lt;p&gt;- EF is not a failure because lazy loading is hard – lazy loading can destroy performance &lt;p&gt;- EF is not a failure because its design tools are 1.0 level &lt;p&gt;- EF is not a failure because it has a poor strategy for merging into source control &lt;p&gt;All of these are potentially issues, but it’s critical, essential, I cannot yell this loud enough – &lt;b&gt;&lt;i&gt;Entity Frameworks must not be designed for the group that is best organized and screams the loudest&lt;/i&gt;&lt;/b&gt;. This already happened once with the disastrous IPOCO attempt that helped no one and wasted a lot of manpower that could have improved mapping and provided better metadata.  &lt;p&gt;But then I’m sort of caught in a corner, because an important point of the petition is correct. Be cautions with EF. Do not jump into Entity Framework because of Microsoft marketing. It’s a tough platform that will get a little easier when the current spasm of books comes out. The niche is pretty narrow and if you step off the boards, the quicksand can be pretty deep. Treat it like what it is - an amazingly large and complex project that is being released as a 1.0 product. It’s an infant. The metadata and mapping still stink. Look at it as Microsoft’s current future direction, but remember how many current future directions we’ve had over the last 15 years (around ten) and remain skeptical. &lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1637369" width="1" height="1"&gt;</description><category domain="http://msmvps.com/blogs/kathleen/archive/tags/General/default.aspx">General</category><category domain="http://msmvps.com/blogs/kathleen/archive/tags/.NET/default.aspx">.NET</category></item><item><title>Runtime vs. Design/Compile Time</title><link>http://msmvps.com/blogs/kathleen/archive/2008/02/14/runtime-vs-design-compile-time.aspx</link><pubDate>Thu, 14 Feb 2008 17:21:00 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1514409</guid><dc:creator>Kathleen</dc:creator><slash:comments>7</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/kathleen/rsscomments.aspx?PostID=1514409</wfw:commentRss><comments>http://msmvps.com/blogs/kathleen/archive/2008/02/14/runtime-vs-design-compile-time.aspx#comments</comments><description>&lt;p&gt;&lt;b&gt;&lt;i&gt;&lt;/i&gt;&lt;/b&gt;&lt;/p&gt;&lt;!--more--&gt;
&lt;p&gt;Chris asks: 
&lt;p&gt;&lt;b&gt;&lt;i&gt;At what point with code gen / templating do you start to think about doing all this codegen at runtime instead of compile time?&lt;/i&gt;&lt;/b&gt; 
&lt;p&gt;&lt;b&gt;&lt;i&gt;And if we were to be doing it at runtime would be be better served by using a dynamic language such as ruby to program in?&lt;/i&gt;&lt;/b&gt; 
&lt;p&gt;That&amp;#39;s a good point. In a perfect world, there would be no need for code generation. We would write nothing but business/domain specific code and everything else would just happen. But for well over twenty years we&amp;#39;ve been aiming for that perfect world and we seem only a few baby steps closer than in 1987. 
&lt;p&gt;In an imperfect world, we have two basic choices, manage an architecture and run a lot of code at design time or manage an architecture and run a lot of code at runtime. Both require a fair amount of configuration. 
&lt;p&gt;And both can offer the real long term benefit of switching away from coding code – which is transitory and dying before you even finish coding. We want to switch away from coding code and toward creating metadata which is a true business representation. Of course metadata changes. But it changes at the speed the business changes – not due to artificial technology shifts. 
&lt;p&gt;For my effort – I want the extra code run at design time to offer the best possible runtime behavior, including performance. I can extend an architecture I’m expressing in templates far easier than I can extend an architecture I am expressing via an OR/M tool. I also want to debug directly into code specific to the problem at hand – I want to debug through generated code, not an OR/M engine. 
&lt;p&gt;The next round of effort at making plumbing simpler from Microsoft is also code generation – Entity Framework. When someone gets the plumbing correct and we truly never need to care, we can turn off the code gen and go direct to whatever structure, however its’ done and completely ignore the problems code gen is primarily used for today. In the long term, we shouldn’t care about anything except the business problem we’re solving. 
&lt;p&gt;Dynamic languages certainly change the architecture. I&amp;#39;m looking forward to exploring them as the overall knowledge base expands. But we&amp;#39;ve been sitting with a pretty dynamic language in our laps for many years, the majority of us have programmed in it, and with the exception of precisely one person - everyone I know varies between mild distaste and downright hatred for it. I think a lot of Javascript&amp;#39;s problems have been related to debugging and platform issues, and I realize that there are differences between Ruby/Python and Javascript. However, if we didn&amp;#39;t fall in love with the dynamic aspects of Javascript in the last ten years, I remain slightly skeptical about dynamic languages in the next few years. Some of the differences, and our attitudes and skills may change as a result, are that the new languages have a broader platform base and we&amp;#39;re increasing our understanding of how to actually use them as opposed to hacking them enough to solve some trivial website detail. 
&lt;p&gt;But at the core, the technique for expressing metadata into a working application is not half as important as metadata at the core of the application, however its expressed. &lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1514409" width="1" height="1"&gt;</description><category domain="http://msmvps.com/blogs/kathleen/archive/tags/.NET/default.aspx">.NET</category><category domain="http://msmvps.com/blogs/kathleen/archive/tags/Code+Generation/default.aspx">Code Generation</category></item><item><title>Open Source</title><link>http://msmvps.com/blogs/kathleen/archive/2008/02/13/open-source.aspx</link><pubDate>Wed, 13 Feb 2008 15:31:24 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1512469</guid><dc:creator>Kathleen</dc:creator><slash:comments>3</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/kathleen/rsscomments.aspx?PostID=1512469</wfw:commentRss><comments>http://msmvps.com/blogs/kathleen/archive/2008/02/13/open-source.aspx#comments</comments><description>&lt;p&gt;It’s occurred to me that if you are following this and my DNR TV show a logical reaction would be “OK, so that’s a lot of hot air, where do I get it?” I intend for all of this to be released Open Source, on whichever site s hot when I release it. I hope I’ll start releasing pieces in just a matter of weeks. It will help a lot if it becomes “we” instead of “me”. So, if you’re interested n this stuff and you want to help, let me know and you can get this stuff directly as its rapidly evolving too much to publically post right now. &lt;/p&gt; &lt;p&gt;My current expectation of the order of release: &lt;ul&gt; &lt;li&gt;Metadata interfaces &lt;/li&gt; &lt;li&gt;GenDotNet metadata load&lt;/li&gt; &lt;li&gt;EDMX metadata load&lt;/li&gt; &lt;li&gt;Template infrastructure – what’s needed for the language neutral templates&lt;/li&gt; &lt;li&gt;Simple harness&lt;/li&gt; &lt;li&gt;Activity based harness&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;If you’re interested, you can contact me directly at Kathleen@mvps.org&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1512469" width="1" height="1"&gt;</description><category domain="http://msmvps.com/blogs/kathleen/archive/tags/.NET/default.aspx">.NET</category><category domain="http://msmvps.com/blogs/kathleen/archive/tags/Code+Generation/default.aspx">Code Generation</category><category domain="http://msmvps.com/blogs/kathleen/archive/tags/Visual+Basic/default.aspx">Visual Basic</category><category domain="http://msmvps.com/blogs/kathleen/archive/tags/C_2300_/default.aspx">C#</category></item><item><title>Isolating Metadata</title><link>http://msmvps.com/blogs/kathleen/archive/2008/02/13/isolating-metadata.aspx</link><pubDate>Wed, 13 Feb 2008 15:26:09 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1512464</guid><dc:creator>Kathleen</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/kathleen/rsscomments.aspx?PostID=1512464</wfw:commentRss><comments>http://msmvps.com/blogs/kathleen/archive/2008/02/13/isolating-metadata.aspx#comments</comments><description>&lt;p&gt;In code generation, metadata is the information about your application, generally about your database and definitions to express your data as business objects. If you use Entity Framework, your metadata is the edmx file which is displayed via the designers. If you’re using CodeSmith, the metadata is more subtle. Metadata can also be about the process itself. CodeBreeze in particular has a very rich set and extensible set of information about your application. &lt;/p&gt; &lt;p&gt;Since metadata itself is data – information - we can store it many ways. I’ve used XML for years. CodeSmith has used a couple of mechanisms including XML. Entity Framework uses XML. Metadata can also come directly from a database, although I think this is a remarkably bad idea and one of my code generation principles is not to do that – you need a level of indirection and isolation surrounding your database.  &lt;p&gt;What I haven’t talked about before how valuable it is to have another layer of indirection between your metadata storage structure – your XML schema – and your templates. In my XSLT templates I could provide this only through a common schema – you can morph your XML into my schema so that’s indirection – right?  &lt;p&gt;No, that’s not really indirection. It’s great to be back in .NET classes with real tools for isolation and abstraction. Now I use a set of interfaces for common metadata constructs such as objects, properties and criteria. I can then offer any number of sets of metadata wrappers that implement these interfaces via a factory.  &lt;p&gt;&amp;nbsp; &lt;p&gt;&lt;a href="http://msmvps.com/blogs/kathleen/WindowsLiveWriter/IsolatingMetadata_769B/MetadataIsolation_2.jpg"&gt;&lt;img style="border-right:0px;border-top:0px;border-left:0px;border-bottom:0px;" height="449" alt="MetadataIsolation" src="http://msmvps.com/blogs/kathleen/WindowsLiveWriter/IsolatingMetadata_769B/MetadataIsolation_thumb.jpg" width="911" border="0" /&gt;&lt;/a&gt;  &lt;p&gt;&amp;nbsp; &lt;p&gt;The template programs only against the interfaces. The template could care less whether I am using entity framework, my own metadata tools, or something entirely different. &lt;b&gt;&lt;i&gt;I can write the same template and use it against Entity Framework’s edmx file or any other metadata format&lt;/i&gt;&lt;/b&gt;. That’s powerful stuff. Especially since you already heard that the template will run against C# or VB. That means in my world the only reason to have more than one set of templates against an architecture like &lt;a href="http://lhotka.net/"&gt;CSLA&lt;/a&gt; is that they are pushing the boundaries and actually doing different things. &lt;p&gt;But if you don’t like this new templating style, you can use classes based on exactly the same interfaces in CodeSmtih (at least) and again free your framework and metadata extraction. You’ll still need VB/C# versions there, but you’re metadata input can use the same interfaces. &lt;p&gt;The interfaces is expressed in sets of classes that know how to load themselves from a data source. Each set uses a different metadata source – different XML structures or other format.  &lt;p&gt;Isolated metadata removes your templates from caring what the metadata source is – beyond being something that could successfully fill a set of classes that implement the data interfaces. This is a very important step and one we need to work together to get right. What do you think I&amp;#39;ve left out of the current design?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1512464" width="1" height="1"&gt;</description><category domain="http://msmvps.com/blogs/kathleen/archive/tags/.NET/default.aspx">.NET</category><category domain="http://msmvps.com/blogs/kathleen/archive/tags/Code+Generation/default.aspx">Code Generation</category><category domain="http://msmvps.com/blogs/kathleen/archive/tags/Design/default.aspx">Design</category><category domain="http://msmvps.com/blogs/kathleen/archive/tags/Visual+Basic/default.aspx">Visual Basic</category><category domain="http://msmvps.com/blogs/kathleen/archive/tags/C_2300_/default.aspx">C#</category></item><item><title>Minnesota VSTS User Group - Code Generation in 2008</title><link>http://msmvps.com/blogs/kathleen/archive/2008/02/13/minnesota-vsts-user-group-code-generation-in-2008.aspx</link><pubDate>Wed, 13 Feb 2008 14:57:00 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1512433</guid><dc:creator>Kathleen</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/kathleen/rsscomments.aspx?PostID=1512433</wfw:commentRss><comments>http://msmvps.com/blogs/kathleen/archive/2008/02/13/minnesota-vsts-user-group-code-generation-in-2008.aspx#comments</comments><description>&lt;p&gt;I&amp;#39;m stepping out of my comfy sandbox again. Not only am I going to Minnesota in February, but I&amp;#39;m also talking to a VSTS user group - to remember that it&amp;#39;s not just about code.&lt;/p&gt; &lt;p&gt;You can get more information &lt;a href="http://www.vstsmn.com/"&gt;here&lt;/a&gt;.&lt;/p&gt; &lt;p&gt;I am really looking forward to this talk and sharing perspectives with people that I&amp;#39;m hoping connect on some of the process questions about code generation. While I dropped the ball on updating the abstract, this talk won&amp;#39;t just be templating techniques - I&amp;#39;ll spend a good bit of time on the research I&amp;#39;ve been doing moving to an activity metaphor for code generation - raising above the simple process declarations. This is very fun stuff and I&amp;#39;m excited to find a group interested in sharing it. If you&amp;#39;re in the area, please come by. &lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1512433" width="1" height="1"&gt;</description><category domain="http://msmvps.com/blogs/kathleen/archive/tags/General/default.aspx">General</category><category domain="http://msmvps.com/blogs/kathleen/archive/tags/.NET/default.aspx">.NET</category></item><item><title>New Jersey SQL Server User Group - SQL Server Stored Procedure Code Generation in 2008</title><link>http://msmvps.com/blogs/kathleen/archive/2008/02/12/new-jersey-sql-server-user-group-sql-server-stored-procedure-code-generation-in-2008.aspx</link><pubDate>Tue, 12 Feb 2008 15:55:00 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1510308</guid><dc:creator>Kathleen</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/kathleen/rsscomments.aspx?PostID=1510308</wfw:commentRss><comments>http://msmvps.com/blogs/kathleen/archive/2008/02/12/new-jersey-sql-server-user-group-sql-server-stored-procedure-code-generation-in-2008.aspx#comments</comments><description>&lt;p&gt;If you can make it to Parsippany, New Jersey on Tuesday Feb. 19, I&amp;#39;ll be talking about code generation. This is a SQL group that&amp;#39;s been kind enough to host a hard core .NET geek. The common ground is stored procedures and making them easier to write, and especially to maintain. They&amp;#39;ve said they&amp;#39;ll be gentle, and I hope to learn a thing or two. It&amp;#39;s always nice to step out of my comfort zone,and I think I can offer a great night. &lt;/p&gt;
&lt;p&gt;So, if you live in the area, I&amp;#39;ll see you at &lt;a href="http://njsql.org/Default.aspx"&gt;the meeting&lt;/a&gt;!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1510308" width="1" height="1"&gt;</description><category domain="http://msmvps.com/blogs/kathleen/archive/tags/.NET/default.aspx">.NET</category></item><item><title>CurrentTypeInfo and the Context Stack</title><link>http://msmvps.com/blogs/kathleen/archive/2008/02/12/currenttypeinfo-and-the-context-stack.aspx</link><pubDate>Tue, 12 Feb 2008 15:46:00 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1510299</guid><dc:creator>Kathleen</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/kathleen/rsscomments.aspx?PostID=1510299</wfw:commentRss><comments>http://msmvps.com/blogs/kathleen/archive/2008/02/12/currenttypeinfo-and-the-context-stack.aspx#comments</comments><description>&lt;p&gt;Creating templates requires a lot of access to the thing you’re currently creating. That’s the current output type, which as I discussed in &lt;a href="http://msmvps.com/blogs/kathleen/archive/2008/02/11/two-parallel-entities-metadata-and-info.aspx"&gt;yesterday&lt;/a&gt; I suffix with “Info.” The CurrentTypeInfo is thus what you’re currently outputting. 
&lt;p&gt;&lt;i&gt;I neglected to clarify in that post that the Data and the Info classes are in entirely different assemblies. The Data classes could be used with any .NET generation mechanism, including (at least) XML Literal code generation and CodeSmith. The Info objects are relatively specific to my style of code generation. &lt;/i&gt;
&lt;p&gt;The CurrentTypeInfo may not be the same throughout the file. 
&lt;p&gt;There are a few reasons to combine multiple classes or enums in a file. In some cases, that’s to nest them, and in some cases it’s just to logically combine them in a file. While FxCop has declared them unfashionable, I find nested classes tremendously valuable, especially for organizing Intellisense and keeping well structured classes and naming. If you’re working with nested classes, there is a good chance you’ll need to access not only the current type, but also the encapsulating type. I use a stack for this, and give control of pushing and popping TypeInfo objects from the stack to the templates themselves. 
&lt;p&gt;&lt;a href="http://msmvps.com/blogs/kathleen/WindowsLiveWriter/CurrentTypeInfoandtheContextStack_7B45/TemplateInheritanceDotNetBase3_2.jpg"&gt;&lt;img style="BORDER-RIGHT:0px;BORDER-TOP:0px;BORDER-LEFT:0px;BORDER-BOTTOM:0px;" height="369" alt="TemplateInheritanceDotNetBase3" src="http://msmvps.com/blogs/kathleen/WindowsLiveWriter/CurrentTypeInfoandtheContextStack_7B45/TemplateInheritanceDotNetBase3_thumb.jpg" width="215" border="0" /&gt;&lt;/a&gt; 
&lt;p&gt;The base item on the stack is the current outer most class in the current file. Once you’ve pulled a class off the stack, such as by popping the base and adding a new base TypeInfo, you can’t access the previous version unless you’ve saved it. 
&lt;p&gt;Here’s where you see the flaw I mentioned yesterday – these classes could be in separate namespaces, and I don’t allow for that – yet. I’ll fix it later. 
&lt;p&gt;Remember the TypeInfo is the thing you’re outputting. The entity definition it’s built from is ObjectData in my semantics. 
&lt;p&gt;The stack is an extremely useful construct for this scenario. You have quick access to information about the class you’re currently outputting. You’ll frequently need this for type information and perhaps calling shared/static methods. You don’t want to recreate its name every time you use it because that would be redundant and hard to maintain. You can also access any of the containing classes, which again is useful in defining types and calling shared/static methods. 
&lt;p&gt;While I haven’t done this in CodeSmith, I expect this technique to be viable there. I’m not sure on other platforms, but it’s not specific to XML literal code generation. &lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1510299" width="1" height="1"&gt;</description><category domain="http://msmvps.com/blogs/kathleen/archive/tags/.NET/default.aspx">.NET</category><category domain="http://msmvps.com/blogs/kathleen/archive/tags/Code+Generation/default.aspx">Code Generation</category><category domain="http://msmvps.com/blogs/kathleen/archive/tags/Visual+Basic/default.aspx">Visual Basic</category><category domain="http://msmvps.com/blogs/kathleen/archive/tags/C_2300_/default.aspx">C#</category></item><item><title>Two Parallel Entities - Metadata and Info</title><link>http://msmvps.com/blogs/kathleen/archive/2008/02/11/two-parallel-entities-metadata-and-info.aspx</link><pubDate>Mon, 11 Feb 2008 17:08:00 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1508491</guid><dc:creator>Kathleen</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/kathleen/rsscomments.aspx?PostID=1508491</wfw:commentRss><comments>http://msmvps.com/blogs/kathleen/archive/2008/02/11/two-parallel-entities-metadata-and-info.aspx#comments</comments><description>&lt;p&gt;One of the confusing things about templating is that you are writing two programs simultaneously and there is no way around it. My brilliant son may write a templating language for a class project, and this is exactly what he wants to address – that and the issue of escaping. You can’t avoid it, he just thinks they should look different – I’m hoping he doesn’t write one in Magyar. 
&lt;p&gt;One of the programs you’re writing (or maintaining) is the template program. There is logic in any non-trivial template, regardless of the template style. The other program is the one you’re outputting that will eventually run on your clients computer. In ASP.NET style templates, the output program is the overall template, and the logic is inserted. In XSLT and XML literal generation, the logic of the template program is the overall code and the output template is nested inside. 
&lt;p&gt;You are also working with two sets of data – the metadata you’re using as source and what you’re currently outputting. I call the elements in the XML I use as source metadata for .NET templates Object and Property for clarity in the XML. If I called them that in the templates, I’d encounter great confusion between the object definition in metadata and the class I am outputting. That’s particularly painful when it comes to properties. 
&lt;p&gt;I solve this by calling suffixing all metadata with the word “Data”. Thus I have ObjectData, PropertyData, CriteriaData, etc. Each of these classes contains the metadata on the corresponding item. I might have an ObjectData for a Customer that had a PropertyData for FirstName. The PropertyData would include things like the maximum length of the field and its caption. 
&lt;p&gt;I also need to describe the output – at least the way I’m building templates. I need information about the file I’m creating, the type I’m creating, and in certain locations in the template, the property, function, constructor, etc I’m creating. I identify these by suffixing them with the word “Info”. Thus I have a ClassInfo, PropertyInfo, FunctionInfo, etc. I do not have a CriteriaInfo because I am never outputting a .NET thing called a Criteria. It’s strictly metadata for .NET features. 
&lt;p&gt;In the template design I’m describing in this series, the DotNetBase class contains information on the file being output. To be picky, the namespace can actually be associated with part of a file, and I may add this flexibility, but I don’t do that very often in business code, so I have included namespaces at the file level.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;a href="http://msmvps.com/blogs/kathleen/WindowsLiveWriter/TwoParallelEntitiesMetadataandInfo_8EA0/TemplateInheritanceDotNetBase2_2.jpg"&gt;&lt;img style="BORDER-RIGHT:0px;BORDER-TOP:0px;BORDER-LEFT:0px;BORDER-BOTTOM:0px;" height="369" alt="TemplateInheritanceDotNetBase2" src="http://msmvps.com/blogs/kathleen/WindowsLiveWriter/TwoParallelEntitiesMetadataandInfo_8EA0/TemplateInheritanceDotNetBase2_thumb.jpg" width="215" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;Regardless of the template mechanism you use, you need to maintain a clear separation between the template logic and the output logic, and between the input metadata and state about what you’re creating. 
&lt;p&gt;Next post: CurrentTypeInfo and the Context Stack&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1508491" width="1" height="1"&gt;</description><category domain="http://msmvps.com/blogs/kathleen/archive/tags/.NET/default.aspx">.NET</category><category domain="http://msmvps.com/blogs/kathleen/archive/tags/Code+Generation/default.aspx">Code Generation</category><category domain="http://msmvps.com/blogs/kathleen/archive/tags/Visual+Basic/default.aspx">Visual Basic</category><category domain="http://msmvps.com/blogs/kathleen/archive/tags/C_2300_/default.aspx">C#</category></item><item><title>Inheritance and Templates</title><link>http://msmvps.com/blogs/kathleen/archive/2008/02/11/inheritance-and-templates.aspx</link><pubDate>Mon, 11 Feb 2008 16:25:00 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1508442</guid><dc:creator>Kathleen</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/kathleen/rsscomments.aspx?PostID=1508442</wfw:commentRss><comments>http://msmvps.com/blogs/kathleen/archive/2008/02/11/inheritance-and-templates.aspx#comments</comments><description>&lt;p&gt;One of the most valuable things about templates written in .NET code of any style is the ability to use inheritance. This is classic inheritance where local state allows you to push functionality into base class methods that would become cumbersome and have excess dependencies if treated as external utility methods. 
&lt;p&gt;Inheritance also allows polymorphism, which is nothing more than a big word for exchangeability – OK, that’s actually a bigger word. Templates are called by something. Life is simpler and harnesses practical if that something is known and predictable, thus it’s logical to have an interface in a common location as a contract to the template interface. If the base class implements this interface and provides functionality via MustInherit/abstract members, there’s further capacity for evolution. 
&lt;p&gt;&lt;a href="http://msmvps.com/blogs/kathleen/WindowsLiveWriter/InheritanceandTemplates_846E/TemplateInheritanceHierarchy_2.jpg"&gt;&lt;img style="BORDER-TOP-WIDTH:0px;BORDER-LEFT-WIDTH:0px;BORDER-BOTTOM-WIDTH:0px;BORDER-RIGHT-WIDTH:0px;" height="736" alt="TemplateInheritanceHierarchy" src="http://msmvps.com/blogs/kathleen/WindowsLiveWriter/InheritanceandTemplates_846E/TemplateInheritanceHierarchy_thumb.jpg" width="623" border="0" /&gt;&lt;/a&gt; 
&lt;p&gt;There are three assemblies involved. The template interface is in a common assembly available to all other assemblies. The base classes are in a support assembly which can be reused across many template sets. The templates themselves are in a separate assembly. For now, I have all templates associated with a project in one assembly, but I may change that to isolate the SQL and the .NET templates. In any case, these template assemblies are sets of templates that work together. 
&lt;p&gt;Inheritance let’s you push common functionality into the base class. Now that we have extension methods they offer an additional mechanism to remove common functionality from the leaf class. I know Scott Hanselman has said he’ll cut off the pinkies of anyone who uses extension methods on classes you own, and I’ll show you when I get to that in a few days why I disagree (although it’s in the DRN TV show). But that explains why my base classes are focused on state more than functionality. The key state issue is what you’re currently working on. In a template, state is metadata. In a .NET template, the important metadata is the definition for the entity you’re currently creating. In my templates, the ObjectData member of the DotNetBase contains this information. 
&lt;p&gt;&lt;a href="http://msmvps.com/blogs/kathleen/WindowsLiveWriter/InheritanceandTemplates_846E/TemplateInheritanceDotNetBase_2.jpg"&gt;&lt;img style="BORDER-RIGHT:0px;BORDER-TOP:0px;BORDER-LEFT:0px;BORDER-BOTTOM:0px;" height="369" alt="TemplateInheritanceDotNetBase" src="http://msmvps.com/blogs/kathleen/WindowsLiveWriter/InheritanceandTemplates_846E/TemplateInheritanceDotNetBase_thumb.jpg" width="215" border="0" /&gt;&lt;/a&gt; 
&lt;p&gt;Stay tuned for the distinction between the input data you’re working on and the thing you’re creating, which explains some of those other members.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1508442" width="1" height="1"&gt;</description><category domain="http://msmvps.com/blogs/kathleen/archive/tags/.NET/default.aspx">.NET</category><category domain="http://msmvps.com/blogs/kathleen/archive/tags/Code+Generation/default.aspx">Code Generation</category><category domain="http://msmvps.com/blogs/kathleen/archive/tags/Visual+Basic/default.aspx">Visual Basic</category><category domain="http://msmvps.com/blogs/kathleen/archive/tags/C_2300_/default.aspx">C#</category></item><item><title>.NET Template Organization</title><link>http://msmvps.com/blogs/kathleen/archive/2008/02/10/net-template-organization.aspx</link><pubDate>Sun, 10 Feb 2008 23:55:00 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1507240</guid><dc:creator>Kathleen</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/kathleen/rsscomments.aspx?PostID=1507240</wfw:commentRss><comments>http://msmvps.com/blogs/kathleen/archive/2008/02/10/net-template-organization.aspx#comments</comments><description>&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;So, now that you know where I’m going with this – language neutral templates – I want to step back to the basics. Even if you don’t want to build language neutral templates, there are things to learn along the way about making good XML literal templates, and why this approach might be better than your current code gen mechanism. Note, the examples in this post are NOT language neutral. Not surprisingly, there are specific requirements for language neutral templates and I want to show basic templating with XML literals, then the language neutral templates. 
&lt;p&gt;If you look at the XML literal sample I posted a few days ago you’ll notice that the entire contents of the output DataPortalFetch method is created within the template method “MemberDataPortalFetch.” This provide important organization as the most common challenging task in code generation is “I have a problem in my output code right here, how do I find where that is in the template. In a simple template this isn’t too hard, but in more complex templates such as CSLA it can be quite challenging. 
&lt;p&gt;Creating templates with an extremely predictable structure is very valuable in creating maintainable templates. To start with each template should have a one to one correspondence with an output class. 
&lt;p&gt;Within this class, the mechanism of the predictable structure is one of the primary differences from codes that are code with template segments (XML literal code generation) and templates with code segments (ASP.NET style template). In an ASP.NET template, the template must parallels the output and this organizes the template. In an XML literal template, you provide the organization with Visual Studio then providing navigation. Code is organized my regions, nested classes and member. Each is its own method preceded by Region, NestedClass or Member. This organizes the template. The entry points create a hierarchy working down to the local code (navigation mechanism #1): 
&lt;p&gt;&amp;nbsp;&amp;nbsp; Protected Overrides Function GenerateFile() As String&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Return _&lt;br /&gt;&amp;lt;code&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;amp;lt;Serializable()&amp;gt; _&lt;br /&gt;Public Class &amp;lt;%= mObjectData.ClassName %&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp; Inherits BusinessBase(Of &amp;lt;%= mObjectData.ClassName %&amp;gt;)&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;lt;%= RegionBusinessMethods() %&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;lt;%= RegionValidationRules() %&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;lt;%= RegionAuthorizationRules() %&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;lt;%= RegionFactoryMethods() %&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;lt;%= RegionDataAccess() %&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;lt;%= RegionExists() %&amp;gt;&lt;br /&gt;End Class&lt;br /&gt;&amp;lt;/code&amp;gt;.Value&lt;br /&gt;&amp;nbsp;&amp;nbsp; End Function 
&lt;p&gt;And 
&lt;p&gt;#Region &amp;quot;Business Methods&amp;quot;&lt;br /&gt;&amp;nbsp;&amp;nbsp; Private Function RegionBusinessMethods() As String&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Return _&lt;br /&gt;&amp;lt;code&amp;gt;&lt;br /&gt;#Region &amp;quot; Business Methods &amp;quot; 
&lt;p&gt;&amp;nbsp;&amp;nbsp; &amp;lt;%= From prop In mObjectData.Properties Select MemberPropertyFields(prop) %&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;lt;%= From child In mObjectData.Children Select MemberChildFields(child) %&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;lt;%= From prop In mObjectData.Properties Select MemberPropertyAccess(prop) %&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;lt;%= From child In mObjectData.Children Select MemberChildAccess(child) %&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;lt;%= MemberIsValid() %&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;lt;%= MemberIsDirty() %&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;lt;%= MemberGetId() %&amp;gt; 
&lt;p&gt;#End Region&lt;br /&gt;&amp;lt;/code&amp;gt;.Value 
&lt;p&gt;&amp;nbsp;&amp;nbsp; End Function 
&lt;p&gt;The carefully named methods also allow you to use alphabetical tools in Visual Studio including the combo box in the upper right of the editor and a class diagram (navigation mechanism #2) which works only because you can predict the name of the member you want from the name of the output member and no other members begin with “Member”, “Region” or “NestedClass” 
&lt;p&gt;The third navigation approach is that the template matches the structure of the output as closely as practical. Thus if the output has a region names “Business Methods” the template does as well. The order of items in the template is top to bottom closely paralleling the order of the output. This allows you to cruise down in the file. 
&lt;p&gt;Template organization is the first step to great templates. &lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1507240" width="1" height="1"&gt;</description><category domain="http://msmvps.com/blogs/kathleen/archive/tags/.NET/default.aspx">.NET</category><category domain="http://msmvps.com/blogs/kathleen/archive/tags/Code+Generation/default.aspx">Code Generation</category><category domain="http://msmvps.com/blogs/kathleen/archive/tags/Visual+Basic/default.aspx">Visual Basic</category><category domain="http://msmvps.com/blogs/kathleen/archive/tags/C_2300_/default.aspx">C#</category></item><item><title>The Punch Line</title><link>http://msmvps.com/blogs/kathleen/archive/2008/02/10/the-punch-line.aspx</link><pubDate>Sun, 10 Feb 2008 23:21:00 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1507199</guid><dc:creator>Kathleen</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/kathleen/rsscomments.aspx?PostID=1507199</wfw:commentRss><comments>http://msmvps.com/blogs/kathleen/archive/2008/02/10/the-punch-line.aspx#comments</comments><description>&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I mentioned a few days ago that there was a punch line for the XML Literal Code Generation. I planned to unveil this slowly, but it just sprung out of the box when Carl posted episode #102 (which I thought was due for &lt;b&gt;&lt;i&gt;next&lt;/i&gt;&lt;/b&gt; Friday. 
&lt;p&gt;And I’m afraid that I need to add that I was sick during the taping and my brain running at half capacity. If anything isn’t clear, please let me know. 
&lt;p&gt;No matter. 
&lt;p&gt;You get to hear sooner. 
&lt;p&gt;I’ll be unveiling the details in about the same time frame, so you’ll have the big picture by next week. 
&lt;p&gt;So, the drumroll please… 
&lt;p&gt;&lt;u&gt;&lt;em&gt;I can create excellent readable templates that output code in Visual Basic or C# - no CodeDOM involved.&lt;/em&gt;&lt;/u&gt; 
&lt;p&gt;I’ll show you how to do that. Watch for more here. &lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1507199" width="1" height="1"&gt;</description><category domain="http://msmvps.com/blogs/kathleen/archive/tags/.NET/default.aspx">.NET</category><category domain="http://msmvps.com/blogs/kathleen/archive/tags/Code+Generation/default.aspx">Code Generation</category><category domain="http://msmvps.com/blogs/kathleen/archive/tags/Visual+Basic/default.aspx">Visual Basic</category><category domain="http://msmvps.com/blogs/kathleen/archive/tags/C_2300_/default.aspx">C#</category></item><item><title>Code for DNR TV # 97 and #98 Sample Code</title><link>http://msmvps.com/blogs/kathleen/archive/2008/02/10/code-for-dnr-tv-97-and-98-sample-code.aspx</link><pubDate>Sun, 10 Feb 2008 23:14:00 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1507190</guid><dc:creator>Kathleen</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/kathleen/rsscomments.aspx?PostID=1507190</wfw:commentRss><comments>http://msmvps.com/blogs/kathleen/archive/2008/02/10/code-for-dnr-tv-97-and-98-sample-code.aspx#comments</comments><description>&lt;p&gt;Sometimes I drop the ball and I did on getting these samples posted. Note that this is for the two episodes I did on 3.5 languages. I think these episodes are a good run through of the features in both languages. The title wound up with the word &amp;quot;Compare&amp;quot; in the title. I&amp;#39;m not sure I really compare them, beyond seeing them side by side, which I think is useful to understand the underlying mechanisms.&lt;/p&gt;
&lt;p&gt;You can get the code &lt;a href="http://gendotnet.com/Downloads/DNRTVNET35LanguageEnhancements/tabid/659/Default.aspx"&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;I will not be posting code for the code generation episode which is episode #102. That code was too transitory for me to want to release. I will be releasing similar code in my blog over the next week or so.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1507190" width="1" height="1"&gt;</description><category domain="http://msmvps.com/blogs/kathleen/archive/tags/.NET/default.aspx">.NET</category><category domain="http://msmvps.com/blogs/kathleen/archive/tags/Visual+Basic/default.aspx">Visual Basic</category><category domain="http://msmvps.com/blogs/kathleen/archive/tags/C_2300_/default.aspx">C#</category></item><item><title>XML Literal Code Genaration - Code again again</title><link>http://msmvps.com/blogs/kathleen/archive/2008/02/10/xml-literal-code-genaration-code-again-again.aspx</link><pubDate>Sun, 10 Feb 2008 16:53:00 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1506692</guid><dc:creator>Kathleen</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/kathleen/rsscomments.aspx?PostID=1506692</wfw:commentRss><comments>http://msmvps.com/blogs/kathleen/archive/2008/02/10/xml-literal-code-genaration-code-again-again.aspx#comments</comments><description>&lt;p&gt;Crap. &lt;/p&gt;
&lt;p&gt;&amp;nbsp;For now, I&amp;#39;m just removing the coloring. Paste this into VS for coloring. It&amp;#39;s much prettier:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp; Private Function MemberDataPortalFetch() As String&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;#39; TODO: Add special handing for timestamp&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Return _&lt;br /&gt;&amp;lt;code&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp; Private Overloads Sub DataPortal_Fetch(ByVal criteria As Criteria)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Using cn As New SqlConnection(&amp;lt;%= mObjectData.ConnectionStringName %&amp;gt;)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cn.Open()&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Using cm As SqlCommand = cn.CreateCommand&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cm.CommandType = CommandType.StoredProcedure&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cm.CommandText = &amp;quot;get&amp;lt;%= mObjectData.ClassName %&amp;gt;&amp;quot;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;%= From prop In mObjectData.PrimaryKeys Select _&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;code&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cm.Parameters.AddWithValue(&amp;quot;@&amp;lt;%= prop.Name %&amp;gt;&amp;quot;, criteria.&amp;lt;%= prop.Name %&amp;gt;)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/code&amp;gt; %&amp;gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Using dr As New SafeDataReader(cm.ExecuteReader)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dr.Read()&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; With dr&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;%= From prop In mObjectData.Properties Select _&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;code&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; m&amp;lt;%= prop.Name %&amp;gt; = &amp;lt;%= GetReadMethod(prop) %&amp;gt;(&amp;quot;&amp;lt;%= prop.Name %&amp;gt;&amp;quot;)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/code&amp;gt;.Value %&amp;gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;#39; load child objects&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .NextResult()&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;%= From child In mObjectData.Children Select _&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;code&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; m&amp;lt;%= child.Name %&amp;gt; = &amp;lt;%= child.Name %&amp;gt; .Get&amp;lt;%= child.Name %&amp;gt; (dr)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/code&amp;gt;.Value %&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; End With&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; End Using&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; End Using&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; End Using&lt;br /&gt;&amp;nbsp;&amp;nbsp; End Sub&lt;br /&gt;&amp;lt;/code&amp;gt;.Value&lt;br /&gt;&amp;nbsp;&amp;nbsp; End Function&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1506692" width="1" height="1"&gt;</description><category domain="http://msmvps.com/blogs/kathleen/archive/tags/.NET/default.aspx">.NET</category><category domain="http://msmvps.com/blogs/kathleen/archive/tags/Code+Generation/default.aspx">Code Generation</category><category domain="http://msmvps.com/blogs/kathleen/archive/tags/Visual+Basic/default.aspx">Visual Basic</category><category domain="http://msmvps.com/blogs/kathleen/archive/tags/C_2300_/default.aspx">C#</category></item><item><title>XML Literal Code Generation - Code again</title><link>http://msmvps.com/blogs/kathleen/archive/2008/02/10/xml-literal-code-generation-code-again.aspx</link><pubDate>Sun, 10 Feb 2008 16:32:00 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1506685</guid><dc:creator>Kathleen</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/kathleen/rsscomments.aspx?PostID=1506685</wfw:commentRss><comments>http://msmvps.com/blogs/kathleen/archive/2008/02/10/xml-literal-code-generation-code-again.aspx#comments</comments><description>&lt;p&gt;OK, that code listing got friend on load. Let me try again.&lt;/p&gt;&amp;nbsp;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Lucida Console&amp;#39;;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-no-proof:yes;mso-fareast-font-family:&amp;#39;Times New Roman&amp;#39;;mso-ansi-language:EN;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR:blue;"&gt;Private&lt;/span&gt; &lt;span style="COLOR:blue;"&gt;Function&lt;/span&gt; MemberDataPortalFetch() &lt;span style="COLOR:blue;"&gt;As&lt;/span&gt; &lt;span style="COLOR:blue;"&gt;String&lt;/span&gt;&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Lucida Console&amp;#39;;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-no-proof:yes;mso-fareast-font-family:&amp;#39;Times New Roman&amp;#39;;mso-ansi-language:EN;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR:blue;"&gt;Return&lt;/span&gt; _&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;COLOR:#6464b9;FONT-FAMILY:&amp;#39;Lucida Console&amp;#39;;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-no-proof:yes;mso-fareast-font-family:&amp;#39;Times New Roman&amp;#39;;mso-ansi-language:EN;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;COLOR:#844646;FONT-FAMILY:&amp;#39;Lucida Console&amp;#39;;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-no-proof:yes;mso-fareast-font-family:&amp;#39;Times New Roman&amp;#39;;mso-ansi-language:EN;"&gt;code&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;COLOR:#6464b9;FONT-FAMILY:&amp;#39;Lucida Console&amp;#39;;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-no-proof:yes;mso-fareast-font-family:&amp;#39;Times New Roman&amp;#39;;mso-ansi-language:EN;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Lucida Console&amp;#39;;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-no-proof:yes;mso-fareast-font-family:&amp;#39;Times New Roman&amp;#39;;mso-ansi-language:EN;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR:#555555;"&gt;Private Overloads Sub DataPortal_Fetch(ByVal criteria As Criteria)&lt;/span&gt;&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Lucida Console&amp;#39;;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-no-proof:yes;mso-fareast-font-family:&amp;#39;Times New Roman&amp;#39;;mso-ansi-language:EN;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR:#555555;"&gt;Using cn As New SqlConnection(&lt;span style="BACKGROUND:yellow;mso-highlight:yellow;"&gt;&amp;lt;%=&lt;/span&gt;&lt;/span&gt; mObjectData.ConnectionStringName &lt;span style="BACKGROUND:yellow;COLOR:#555555;mso-highlight:yellow;"&gt;%&amp;gt;&lt;/span&gt;&lt;span style="COLOR:#555555;"&gt;)&lt;/span&gt;&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Lucida Console&amp;#39;;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-no-proof:yes;mso-fareast-font-family:&amp;#39;Times New Roman&amp;#39;;mso-ansi-language:EN;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR:#555555;"&gt;cn.Open()&lt;/span&gt;&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Lucida Console&amp;#39;;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-no-proof:yes;mso-fareast-font-family:&amp;#39;Times New Roman&amp;#39;;mso-ansi-language:EN;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR:#555555;"&gt;Using cm As SqlCommand = cn.CreateCommand&lt;/span&gt;&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Lucida Console&amp;#39;;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-no-proof:yes;mso-fareast-font-family:&amp;#39;Times New Roman&amp;#39;;mso-ansi-language:EN;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR:#555555;"&gt;cm.CommandType = CommandType.StoredProcedure&lt;/span&gt;&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Lucida Console&amp;#39;;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-no-proof:yes;mso-fareast-font-family:&amp;#39;Times New Roman&amp;#39;;mso-ansi-language:EN;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR:#555555;"&gt;cm.CommandText = &amp;quot;get&lt;span style="BACKGROUND:yellow;mso-highlight:yellow;"&gt;&amp;lt;%=&lt;/span&gt;&lt;/span&gt; mObjectData.ClassName &lt;span style="BACKGROUND:yellow;COLOR:#555555;mso-highlight:yellow;"&gt;%&amp;gt;&lt;/span&gt;&lt;span style="COLOR:#555555;"&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Lucida Console&amp;#39;;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-no-proof:yes;mso-fareast-font-family:&amp;#39;Times New Roman&amp;#39;;mso-ansi-language:EN;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="BACKGROUND:yellow;COLOR:#555555;mso-highlight:yellow;"&gt;&amp;lt;%=&lt;/span&gt; &lt;span style="COLOR:blue;"&gt;From&lt;/span&gt; prop &lt;span style="COLOR:blue;"&gt;In&lt;/span&gt; mObjectData.PrimaryKeys &lt;span style="COLOR:blue;"&gt;Select&lt;/span&gt; _&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Lucida Console&amp;#39;;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-no-proof:yes;mso-fareast-font-family:&amp;#39;Times New Roman&amp;#39;;mso-ansi-language:EN;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR:#6464b9;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR:#844646;"&gt;code&lt;/span&gt;&lt;span style="COLOR:#6464b9;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Lucida Console&amp;#39;;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-no-proof:yes;mso-fareast-font-family:&amp;#39;Times New Roman&amp;#39;;mso-ansi-language:EN;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR:#555555;"&gt;cm.Parameters.AddWithValue(&amp;quot;@&lt;span style="BACKGROUND:yellow;mso-highlight:yellow;"&gt;&amp;lt;%=&lt;/span&gt;&lt;/span&gt; prop.Name &lt;span style="BACKGROUND:yellow;COLOR:#555555;mso-highlight:yellow;"&gt;%&amp;gt;&lt;/span&gt;&lt;span style="COLOR:#555555;"&gt;&amp;quot;, criteria.&lt;span style="BACKGROUND:yellow;mso-highlight:yellow;"&gt;&amp;lt;%=&lt;/span&gt;&lt;/span&gt; prop.Name &lt;span style="BACKGROUND:yellow;COLOR:#555555;mso-highlight:yellow;"&gt;%&amp;gt;&lt;/span&gt;&lt;span style="COLOR:#555555;"&gt;)&lt;/span&gt;&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Lucida Console&amp;#39;;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-no-proof:yes;mso-fareast-font-family:&amp;#39;Times New Roman&amp;#39;;mso-ansi-language:EN;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR:#6464b9;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR:#844646;"&gt;code&lt;/span&gt;&lt;span style="COLOR:#6464b9;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="BACKGROUND:yellow;COLOR:#555555;mso-highlight:yellow;"&gt;%&amp;gt;&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:#555555;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Lucida Console&amp;#39;;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-no-proof:yes;mso-fareast-font-family:&amp;#39;Times New Roman&amp;#39;;mso-ansi-language:EN;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR:#555555;"&gt;Using dr As New SafeDataReader(cm.ExecuteReader)&lt;/span&gt;&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Lucida Console&amp;#39;;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-no-proof:yes;mso-fareast-font-family:&amp;#39;Times New Roman&amp;#39;;mso-ansi-language:EN;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR:#555555;"&gt;dr.Read()&lt;/span&gt;&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Lucida Console&amp;#39;;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-no-proof:yes;mso-fareast-font-family:&amp;#39;Times New Roman&amp;#39;;mso-ansi-language:EN;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:#555555;"&gt;With dr&lt;/span&gt;&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Lucida Console&amp;#39;;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-no-proof:yes;mso-fareast-font-family:&amp;#39;Times New Roman&amp;#39;;mso-ansi-language:EN;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="BACKGROUND:yellow;COLOR:#555555;mso-highlight:yellow;"&gt;&amp;lt;%=&lt;/span&gt; &lt;span style="COLOR:blue;"&gt;From&lt;/span&gt; prop &lt;span style="COLOR:blue;"&gt;In&lt;/span&gt; mObjectData.Properties &lt;span style="COLOR:blue;"&gt;Select&lt;/span&gt; _&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR:#6464b9;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR:#844646;"&gt;code&lt;/span&gt;&lt;span style="COLOR:#6464b9;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Lucida Console&amp;#39;;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-no-proof:yes;mso-fareast-font-family:&amp;#39;Times New Roman&amp;#39;;mso-ansi-language:EN;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR:#555555;"&gt;m&lt;span style="BACKGROUND:yellow;mso-highlight:yellow;"&gt;&amp;lt;%=&lt;/span&gt;&lt;/span&gt; prop.Name &lt;span style="BACKGROUND:yellow;COLOR:#555555;mso-highlight:yellow;"&gt;%&amp;gt;&lt;/span&gt; &lt;span style="COLOR:#555555;"&gt;= &lt;span style="BACKGROUND:yellow;mso-highlight:yellow;"&gt;&amp;lt;%=&lt;/span&gt;&lt;/span&gt; GetReadMethod(prop) &lt;span style="BACKGROUND:yellow;COLOR:#555555;mso-highlight:yellow;"&gt;%&amp;gt;&lt;/span&gt;&lt;span style="COLOR:#555555;"&gt;(&amp;quot;&lt;span style="BACKGROUND:yellow;mso-highlight:yellow;"&gt;&amp;lt;%=&lt;/span&gt;&lt;/span&gt; prop.Name &lt;span style="BACKGROUND:yellow;COLOR:#555555;mso-highlight:yellow;"&gt;%&amp;gt;&lt;/span&gt;&lt;span style="COLOR:#555555;"&gt;&amp;quot;)&lt;/span&gt;&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Lucida Console&amp;#39;;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-no-proof:yes;mso-fareast-font-family:&amp;#39;Times New Roman&amp;#39;;mso-ansi-language:EN;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR:#6464b9;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR:#844646;"&gt;code&lt;/span&gt;&lt;span style="COLOR:#6464b9;"&gt;&amp;gt;&lt;/span&gt;.Value &lt;span style="BACKGROUND:yellow;COLOR:#555555;mso-highlight:yellow;"&gt;%&amp;gt;&amp;nbsp;&lt;/span&gt;&lt;span style="COLOR:#555555;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Lucida Console&amp;#39;;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-no-proof:yes;mso-fareast-font-family:&amp;#39;Times New Roman&amp;#39;;mso-ansi-language:EN;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR:#555555;"&gt;&amp;#39; load child objects&lt;/span&gt;&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Lucida Console&amp;#39;;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-no-proof:yes;mso-fareast-font-family:&amp;#39;Times New Roman&amp;#39;;mso-ansi-language:EN;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR:#555555;"&gt;.NextResult()&lt;/span&gt;&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Lucida Console&amp;#39;;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-no-proof:yes;mso-fareast-font-family:&amp;#39;Times New Roman&amp;#39;;mso-ansi-language:EN;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="BACKGROUND:yellow;COLOR:#555555;mso-highlight:yellow;"&gt;&amp;lt;%=&lt;/span&gt; &lt;span style="COLOR:blue;"&gt;From&lt;/span&gt; child &lt;span style="COLOR:blue;"&gt;In&lt;/span&gt; mObjectData.Children &lt;span style="COLOR:blue;"&gt;Select&lt;/span&gt; _&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR:#6464b9;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR:#844646;"&gt;code&lt;/span&gt;&lt;span style="COLOR:#6464b9;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Lucida Console&amp;#39;;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-no-proof:yes;mso-fareast-font-family:&amp;#39;Times New Roman&amp;#39;;mso-ansi-language:EN;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR:#555555;"&gt;m&lt;span style="BACKGROUND:yellow;mso-highlight:yellow;"&gt;&amp;lt;%=&lt;/span&gt;&lt;/span&gt; child.Name &lt;span style="BACKGROUND:yellow;COLOR:#555555;mso-highlight:yellow;"&gt;%&amp;gt;&lt;/span&gt; &lt;span style="COLOR:#555555;"&gt;= &lt;span style="BACKGROUND:yellow;mso-highlight:yellow;"&gt;&amp;lt;%=&lt;/span&gt;&lt;/span&gt; child.Name &lt;span style="BACKGROUND:yellow;COLOR:#555555;mso-highlight:yellow;"&gt;%&amp;gt;&lt;/span&gt;&lt;span style="COLOR:#555555;"&gt;.Get&lt;span style="BACKGROUND:yellow;mso-highlight:yellow;"&gt;&amp;lt;%=&lt;/span&gt;&lt;/span&gt; child.Name &lt;span style="BACKGROUND:yellow;COLOR:#555555;mso-highlight:yellow;"&gt;%&amp;gt;&lt;/span&gt; &lt;span style="COLOR:#555555;"&gt;(dr)&lt;/span&gt;&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;COLOR:#555555;FONT-FAMILY:&amp;#39;Lucida Console&amp;#39;;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-no-proof:yes;mso-fareast-font-family:&amp;#39;Times New Roman&amp;#39;;mso-ansi-language:EN;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Lucida Console&amp;#39;;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-no-proof:yes;mso-fareast-font-family:&amp;#39;Times New Roman&amp;#39;;mso-ansi-language:EN;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR:#6464b9;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR:#844646;"&gt;code&lt;/span&gt;&lt;span style="COLOR:#6464b9;"&gt;&amp;gt;&lt;/span&gt;.Value &lt;span style="BACKGROUND:yellow;COLOR:#555555;mso-highlight:yellow;"&gt;%&amp;gt;&lt;/span&gt;&lt;span style="COLOR:#555555;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Lucida Console&amp;#39;;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-no-proof:yes;mso-fareast-font-family:&amp;#39;Times New Roman&amp;#39;;mso-ansi-language:EN;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR:#555555;"&gt;End With&lt;/span&gt;&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Lucida Console&amp;#39;;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-no-proof:yes;mso-fareast-font-family:&amp;#39;Times New Roman&amp;#39;;mso-ansi-language:EN;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR:#555555;"&gt;End Using&lt;/span&gt;&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Lucida Console&amp;#39;;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-no-proof:yes;mso-fareast-font-family:&amp;#39;Times New Roman&amp;#39;;mso-ansi-language:EN;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR:#555555;"&gt;End Using&lt;/span&gt;&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Lucida Console&amp;#39;;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-no-proof:yes;mso-fareast-font-family:&amp;#39;Times New Roman&amp;#39;;mso-ansi-language:EN;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR:#555555;"&gt;End Using&lt;/span&gt;&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Lucida Console&amp;#39;;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-no-proof:yes;mso-fareast-font-family:&amp;#39;Times New Roman&amp;#39;;mso-ansi-language:EN;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR:#555555;"&gt;End Sub&lt;/span&gt;&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;COLOR:#6464b9;FONT-FAMILY:&amp;#39;Lucida Console&amp;#39;;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-no-proof:yes;mso-fareast-font-family:&amp;#39;Times New Roman&amp;#39;;mso-ansi-language:EN;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;COLOR:#844646;FONT-FAMILY:&amp;#39;Lucida Console&amp;#39;;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-no-proof:yes;mso-fareast-font-family:&amp;#39;Times New Roman&amp;#39;;mso-ansi-language:EN;"&gt;code&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;COLOR:#6464b9;FONT-FAMILY:&amp;#39;Lucida Console&amp;#39;;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-no-proof:yes;mso-fareast-font-family:&amp;#39;Times New Roman&amp;#39;;mso-ansi-language:EN;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Lucida Console&amp;#39;;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-no-proof:yes;mso-fareast-font-family:&amp;#39;Times New Roman&amp;#39;;mso-ansi-language:EN;"&gt;.Value&lt;/span&gt;&lt;span style="FONT-SIZE:12pt;FONT-FAMILY:&amp;#39;Times New Roman&amp;#39;,&amp;#39;serif&amp;#39;;mso-fareast-font-family:&amp;#39;Times New Roman&amp;#39;;mso-ansi-language:EN;"&gt; &lt;/span&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Lucida Console&amp;#39;;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-no-proof:yes;mso-fareast-font-family:&amp;#39;Times New Roman&amp;#39;;mso-ansi-language:EN;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR:blue;"&gt;End&lt;/span&gt; &lt;span style="COLOR:blue;"&gt;Function&lt;/span&gt;&lt;/span&gt;&lt;span style="FONT-SIZE:12pt;FONT-FAMILY:&amp;#39;Times New Roman&amp;#39;,&amp;#39;serif&amp;#39;;mso-fareast-font-family:&amp;#39;Times New Roman&amp;#39;;mso-ansi-language:EN;"&gt;&lt;/span&gt; 
&lt;p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1506685" width="1" height="1"&gt;</description><category domain="http://msmvps.com/blogs/kathleen/archive/tags/.NET/default.aspx">.NET</category><category domain="http://msmvps.com/blogs/kathleen/archive/tags/Code+Generation/default.aspx">Code Generation</category><category domain="http://msmvps.com/blogs/kathleen/archive/tags/Visual+Basic/default.aspx">Visual Basic</category><category domain="http://msmvps.com/blogs/kathleen/archive/tags/C_2300_/default.aspx">C#</category></item><item><title>XML Literal Code Generation</title><link>http://msmvps.com/blogs/kathleen/archive/2008/02/08/xml-literal-code-generation.aspx</link><pubDate>Fri, 08 Feb 2008 17:20:00 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1503666</guid><dc:creator>Kathleen</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/kathleen/rsscomments.aspx?PostID=1503666</wfw:commentRss><comments>http://msmvps.com/blogs/kathleen/archive/2008/02/08/xml-literal-code-generation.aspx#comments</comments><description>&lt;p class="MsoNormal" style="MARGIN:0in 0in 10pt;"&gt;&lt;font face="Calibri" size="3"&gt;You must use VB for XML Literal Code Generation. Sorry, that’s life. I don’t have a crystal ball on this, but for now even if you’re a C# programmer you’ve got to suck it up and use VB. The code you output can be VB or C# however, but the template itself has to be written in VB. If you’re allergic to VB, get shots. &lt;/font&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN:0in 0in 10pt;"&gt;&lt;font face="Calibri" size="3"&gt;So, what does a microcosmic view of a XML literal template look like? I’ve translated a section of a &lt;/font&gt;&lt;a href="http://www.csla.net/"&gt;&lt;font face="Calibri" color="#0000ff" size="3"&gt;CSLA&lt;/font&gt;&lt;/a&gt;&lt;font face="Calibri" size="3"&gt; template. CSLA is Rocky Lhotka’s architecture and this is a version 2.1 because I think it clarifies the template process:&lt;/font&gt;&lt;/p&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Lucida Console&amp;#39;;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-no-proof:yes;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR:blue;"&gt;Private&lt;/span&gt; &lt;span style="COLOR:blue;"&gt;Function&lt;/span&gt; MemberDataPortalFetch() &lt;span style="COLOR:blue;"&gt;As&lt;/span&gt; &lt;span style="COLOR:blue;"&gt;String&lt;/span&gt;&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Lucida Console&amp;#39;;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-no-proof:yes;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR:blue;"&gt;Return&lt;/span&gt; _&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;COLOR:#6464b9;FONT-FAMILY:&amp;#39;Lucida Console&amp;#39;;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-no-proof:yes;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;COLOR:#844646;FONT-FAMILY:&amp;#39;Lucida Console&amp;#39;;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-no-proof:yes;"&gt;code&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;COLOR:#6464b9;FONT-FAMILY:&amp;#39;Lucida Console&amp;#39;;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-no-proof:yes;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Lucida Console&amp;#39;;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-no-proof:yes;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR:#555555;"&gt;Private Overloads Sub DataPortal_Fetch(ByVal criteria As Criteria)&lt;/span&gt;&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Lucida Console&amp;#39;;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-no-proof:yes;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR:#555555;"&gt;Using cn As New SqlConnection(&lt;span style="BACKGROUND:yellow;mso-highlight:yellow;"&gt;&amp;lt;%=&lt;/span&gt;&lt;/span&gt; mObjectData.ConnectionStringName &lt;span style="BACKGROUND:yellow;COLOR:#555555;mso-highlight:yellow;"&gt;%&amp;gt;&lt;/span&gt;&lt;span style="COLOR:#555555;"&gt;)&lt;/span&gt;&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Lucida Console&amp;#39;;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-no-proof:yes;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR:#555555;"&gt;cn.Open()&lt;/span&gt;&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Lucida Console&amp;#39;;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-no-proof:yes;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR:#555555;"&gt;Using cm As SqlCommand = cn.CreateCommand&lt;/span&gt;&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Lucida Console&amp;#39;;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-no-proof:yes;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR:#555555;"&gt;cm.CommandType = CommandType.StoredProcedure&lt;/span&gt;&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Lucida Console&amp;#39;;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-no-proof:yes;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR:#555555;"&gt;cm.CommandText = &amp;quot;get&lt;span style="BACKGROUND:yellow;mso-highlight:yellow;"&gt;&amp;lt;%=&lt;/span&gt;&lt;/span&gt; mObjectData.ClassName &lt;span style="BACKGROUND:yellow;COLOR:#555555;mso-highlight:yellow;"&gt;%&amp;gt;&lt;/span&gt;&lt;span style="COLOR:#555555;"&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Lucida Console&amp;#39;;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-no-proof:yes;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="BACKGROUND:yellow;COLOR:#555555;mso-highlight:yellow;"&gt;&amp;lt;%=&lt;/span&gt; &lt;span style="COLOR:blue;"&gt;From&lt;/span&gt; prop &lt;span style="COLOR:blue;"&gt;In&lt;/span&gt; mObjectData.PrimaryKeys &lt;span style="COLOR:blue;"&gt;Select&lt;/span&gt; _&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Lucida Console&amp;#39;;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-no-proof:yes;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR:#6464b9;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR:#844646;"&gt;code&lt;/span&gt;&lt;span style="COLOR:#6464b9;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Lucida Console&amp;#39;;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-no-proof:yes;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR:#555555;"&gt;cm.Parameters.AddWithValue(&amp;quot;@&lt;span style="BACKGROUND:yellow;mso-highlight:yellow;"&gt;&amp;lt;%=&lt;/span&gt;&lt;/span&gt; prop.Name &lt;span style="BACKGROUND:yellow;COLOR:#555555;mso-highlight:yellow;"&gt;%&amp;gt;&lt;/span&gt;&lt;span style="COLOR:#555555;"&gt;&amp;quot;, criteria.&lt;span style="BACKGROUND:yellow;mso-highlight:yellow;"&gt;&amp;lt;%=&lt;/span&gt;&lt;/span&gt; prop.Name &lt;span style="BACKGROUND:yellow;COLOR:#555555;mso-highlight:yellow;"&gt;%&amp;gt;&lt;/span&gt;&lt;span style="COLOR:#555555;"&gt;)&lt;/span&gt;&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Lucida Console&amp;#39;;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-no-proof:yes;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR:#6464b9;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR:#844646;"&gt;code&lt;/span&gt;&lt;span style="COLOR:#6464b9;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="BACKGROUND:yellow;COLOR:#555555;mso-highlight:yellow;"&gt;%&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;BACKGROUND:yellow;COLOR:#555555;FONT-FAMILY:&amp;#39;Lucida Console&amp;#39;;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-no-proof:yes;mso-highlight:yellow;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Lucida Console&amp;#39;;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-no-proof:yes;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR:#555555;"&gt;Using dr As New SafeDataReader(cm.ExecuteReader)&lt;/span&gt;&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Lucida Console&amp;#39;;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-no-proof:yes;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR:#555555;"&gt;dr.Read()&lt;/span&gt;&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Lucida Console&amp;#39;;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-no-proof:yes;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR:#555555;"&gt;With dr&lt;/span&gt;&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Lucida Console&amp;#39;;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-no-proof:yes;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="BACKGROUND:yellow;COLOR:#555555;mso-highlight:yellow;"&gt;&amp;lt;%=&lt;/span&gt; &lt;span style="COLOR:blue;"&gt;From&lt;/span&gt; prop &lt;span style="COLOR:blue;"&gt;In&lt;/span&gt; mObjectData.Properties &lt;span style="COLOR:blue;"&gt;Select&lt;/span&gt; _&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Lucida Console&amp;#39;;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-no-proof:yes;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR:#6464b9;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR:#844646;"&gt;code&lt;/span&gt;&lt;span style="COLOR:#6464b9;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Lucida Console&amp;#39;;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-no-proof:yes;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR:#555555;"&gt;m&lt;span style="BACKGROUND:yellow;mso-highlight:yellow;"&gt;&amp;lt;%=&lt;/span&gt;&lt;/span&gt; prop.Name &lt;span style="BACKGROUND:yellow;COLOR:#555555;mso-highlight:yellow;"&gt;%&amp;gt;&lt;/span&gt; &lt;span style="COLOR:#555555;"&gt;= &lt;span style="BACKGROUND:yellow;mso-highlight:yellow;"&gt;&amp;lt;%=&lt;/span&gt;&lt;/span&gt; GetReadMethod(prop) &lt;span style="BACKGROUND:yellow;COLOR:#555555;mso-highlight:yellow;"&gt;%&amp;gt;&lt;/span&gt;&lt;span style="COLOR:#555555;"&gt;(&amp;quot;&lt;span style="BACKGROUND:yellow;mso-highlight:yellow;"&gt;&amp;lt;%=&lt;/span&gt;&lt;/span&gt; prop.Name &lt;span style="BACKGROUND:yellow;COLOR:#555555;mso-highlight:yellow;"&gt;%&amp;gt;&lt;/span&gt;&lt;span style="COLOR:#555555;"&gt;&amp;quot;)&lt;/span&gt;&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Lucida Console&amp;#39;;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-no-proof:yes;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR:#6464b9;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR:#844646;"&gt;code&lt;/span&gt;&lt;span style="COLOR:#6464b9;"&gt;&amp;gt;&lt;/span&gt;.Value &lt;span style="BACKGROUND:yellow;COLOR:#555555;mso-highlight:yellow;"&gt;%&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;BACKGROUND:yellow;COLOR:#555555;FONT-FAMILY:&amp;#39;Lucida Console&amp;#39;;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-no-proof:yes;mso-highlight:yellow;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Lucida Console&amp;#39;;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-no-proof:yes;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR:#555555;"&gt;&amp;#39; load child objects&lt;/span&gt;&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Lucida Console&amp;#39;;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-no-proof:yes;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR:#555555;"&gt;.NextResult()&lt;/span&gt;&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Lucida Console&amp;#39;;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-no-proof:yes;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="BACKGROUND:yellow;COLOR:#555555;mso-highlight:yellow;"&gt;&amp;lt;%=&lt;/span&gt; &lt;span style="COLOR:blue;"&gt;From&lt;/span&gt; child &lt;span style="COLOR:blue;"&gt;In&lt;/span&gt; mObjectData.Children &lt;span style="COLOR:blue;"&gt;Select&lt;/span&gt; _&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Lucida Console&amp;#39;;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-no-proof:yes;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR:#6464b9;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR:#844646;"&gt;code&lt;/span&gt;&lt;span style="COLOR:#6464b9;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Lucida Console&amp;#39;;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-no-proof:yes;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR:#555555;"&gt;m&lt;span style="BACKGROUND:yellow;mso-highlight:yellow;"&gt;&amp;lt;%=&lt;/span&gt;&lt;/span&gt; child.Name &lt;span style="BACKGROUND:yellow;COLOR:#555555;mso-highlight:yellow;"&gt;%&amp;gt;&lt;/span&gt; &lt;span style="COLOR:#555555;"&gt;= &lt;span style="BACKGROUND:yellow;mso-highlight:yellow;"&gt;&amp;lt;%=&lt;/span&gt;&lt;/span&gt; child.Name &lt;span style="BACKGROUND:yellow;COLOR:#555555;mso-highlight:yellow;"&gt;%&amp;gt;&lt;/span&gt; &lt;span style="COLOR:#555555;"&gt;.Get&lt;span style="BACKGROUND:yellow;mso-highlight:yellow;"&gt;&amp;lt;%=&lt;/span&gt;&lt;/span&gt; child.Name &lt;span style="BACKGROUND:yellow;COLOR:#555555;mso-highlight:yellow;"&gt;%&amp;gt;&lt;/span&gt; &lt;span style="COLOR:#555555;"&gt;(dr)&lt;/span&gt;&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Lucida Console&amp;#39;;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-no-proof:yes;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR:#6464b9;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR:#844646;"&gt;code&lt;/span&gt;&lt;span style="COLOR:#6464b9;"&gt;&amp;gt;&lt;/span&gt;.Value &lt;span style="BACKGROUND:yellow;COLOR:#555555;mso-highlight:yellow;"&gt;%&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Lucida Console&amp;#39;;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-no-proof:yes;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR:#555555;"&gt;End With&lt;/span&gt;&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Lucida Console&amp;#39;;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-no-proof:yes;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR:#555555;"&gt;End Using&lt;/span&gt;&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Lucida Console&amp;#39;;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-no-proof:yes;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR:#555555;"&gt;End Using&lt;/span&gt;&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Lucida Console&amp;#39;;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-no-proof:yes;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR:#555555;"&gt;End Using&lt;/span&gt;&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Lucida Console&amp;#39;;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-no-proof:yes;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR:#555555;"&gt;End Sub&lt;/span&gt;&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;COLOR:#6464b9;FONT-FAMILY:&amp;#39;Lucida Console&amp;#39;;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-no-proof:yes;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;COLOR:#844646;FONT-FAMILY:&amp;#39;Lucida Console&amp;#39;;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-no-proof:yes;"&gt;code&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;COLOR:#6464b9;FONT-FAMILY:&amp;#39;Lucida Console&amp;#39;;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-no-proof:yes;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Lucida Console&amp;#39;;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-no-proof:yes;"&gt;.Value&lt;/span&gt; 
&lt;p class="MsoNormal" style="MARGIN:0in 0in 10pt;"&gt;&lt;span style="FONT-SIZE:10pt;LINE-HEIGHT:115%;FONT-FAMILY:&amp;#39;Lucida Console&amp;#39;;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-no-proof:yes;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR:blue;"&gt;End&lt;/span&gt; &lt;span style="COLOR:blue;"&gt;Function&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN:0in 0in 10pt;"&gt;&lt;font face="Calibri" size="3"&gt;This is .NET code, which you can see because the template output is inside a .NET function named MemberDataPortalFetch which returns a string constructed with XML literals. By offsetting with XML literals, the code of the function is easily seen – it’s in gray. All of the gray code will be in the output, none of the yellow, blue or black code will be in the output, although it will certainly affect the output. &lt;/font&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN:0in 0in 10pt;"&gt;&lt;font face="Calibri" size="3"&gt;Where replacements are necessary, XML literals have “embedded expressions” which I have the habit of calling “expression holes.” I’ll talk in another post about what mObjectDatais, but an embedded expression can contain whatever expression you need. An expression is something that returns a value within a single line. So, you can call methods and properties, but you can’t call a subroutine. &lt;/font&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN:0in 0in 10pt;"&gt;&lt;font face="Calibri" size="3"&gt;Embedded expressions can contain LINQ as shown in the third embedded expression. Here we want to add parameters for all the primary keys. &lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&lt;/span&gt;Within the LINQ Select clause, I can use any string. Including the nested code block creates a more readable template and consistency, among other things.&lt;/font&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN:0in 0in 10pt;"&gt;&lt;font face="Calibri" size="3"&gt;A quick glance may leave you thinking that this is just a variation of the ASP.NET style template syntax used by CodeSmith, CodeBreeze, MyGeneration and others. However, it’s quite different. To begin with its organized into members of a template class. Then, the logic is expressed in expressions, not direct template logic. Finally, you can nest back and forth between output text and code to any depth you require. The code blocks within the LINQ statements above contain embedded expressions. These embedded expressions could be further LINQ statements with further code blocks, etc. &lt;/font&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN:0in 0in 10pt;"&gt;&lt;font face="Calibri" size="3"&gt;I think there are right and wrong ways to build templates with XML literals. I’ll spend the next couple of posts talking about template organization and metadata handling. &lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1503666" width="1" height="1"&gt;</description><category domain="http://msmvps.com/blogs/kathleen/archive/tags/.NET/default.aspx">.NET</category><category domain="http://msmvps.com/blogs/kathleen/archive/tags/Code+Generation/default.aspx">Code Generation</category><category domain="http://msmvps.com/blogs/kathleen/archive/tags/Visual+Basic/default.aspx">Visual Basic</category><category domain="http://msmvps.com/blogs/kathleen/archive/tags/C_2300_/default.aspx">C#</category></item><item><title>Let’s Talk Templates</title><link>http://msmvps.com/blogs/kathleen/archive/2008/02/07/let-s-talk-templates.aspx</link><pubDate>Thu, 07 Feb 2008 22:07:00 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1501999</guid><dc:creator>Kathleen</dc:creator><slash:comments>5</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/kathleen/rsscomments.aspx?PostID=1501999</wfw:commentRss><comments>http://msmvps.com/blogs/kathleen/archive/2008/02/07/let-s-talk-templates.aspx#comments</comments><description>&lt;p class="MsoNormal" style="MARGIN:0in 0in 10pt;"&gt;&lt;font face="Calibri" size="3"&gt;Code generation templates have several competing pressures – they need to be easy to use and they need to be powerful. They need to be flexible but encourage best practices. If you ever say “my templates got me started then I had to customize them” you’re templating can be better. I’m not aware of any situation where you can’t isolate the handcrafted code from the generated code sufficiently to keep code generation active for the entire life of your application. &lt;/font&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN:0in 0in 10pt;"&gt;&lt;font face="Calibri" size="3"&gt;When I say full life cycle, I mean from initial prototypes to finally pulling the switch in a decade. Yep a decade. Code generation should aim for evolution and extremely long project life cycles. The metadata of the project can far outlive the technology, even outlive the database. That requires a deep commitment to code generation, and if you don’t have that commitment, the flip side is that code generation can pay back today. At that moment when it feels easier to pull a file out of code generation, or to repeat a similar block of code in two places instead of pushing it into your code gen templates, that’s where the commitment comes in. With or without it, you get payback; it’s just greater the deeper your commitment is to the metadata and templates. &lt;/font&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN:0in 0in 10pt;"&gt;&lt;font face="Calibri" size="3"&gt;My current client pushes me because he is even more committed to the decade long lifecycle based on code gen than I am. And he’s right. Every time he’s pushed to get something into templates or do code gen better, it’s taken less work and gotten us further in the short term than I expected. &lt;/font&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN:0in 0in 10pt;"&gt;&lt;font face="Calibri" size="3"&gt;What if you could combine the simplicity of CodeSmith with the power of XSLT?&lt;/font&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN:0in 0in 10pt;"&gt;&lt;font face="Calibri" size="3"&gt;And what if you could do it primarily in a language and architecture you already know, or should be learning anyway?&lt;/font&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN:0in 0in 10pt;"&gt;&lt;font face="Calibri" size="3"&gt;Interested?&lt;/font&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN:0in 0in 10pt;"&gt;&lt;font face="Calibri" size="3"&gt;This is the first post in a blog series to present this templating style. I also covered in a.NET Rocks show I recorded yesterday. I’m very excited about it, but I want to introduce the basics before I tell you the real punch line. This template style is the best way to generate code today and it’s based entirely on tools you’ve got on your desktop right now. &lt;/font&gt;&lt;/p&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt;Look for more here and in the .NET Rocks TV episode scheduled to appear Feb. 15&lt;sup&gt;th&lt;/sup&gt;. The beautiful thing about the techniques I’ll show is that you can smoothly transition from simple to complex templates dialing in the exact complexity appropriate for your organization and application. &lt;i style="mso-bidi-font-style:normal;"&gt;And, just wait for the punch line.&lt;/i&gt;&lt;/font&gt;&lt;/font&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1501999" width="1" height="1"&gt;</description><category domain="http://msmvps.com/blogs/kathleen/archive/tags/.NET/default.aspx">.NET</category><category domain="http://msmvps.com/blogs/kathleen/archive/tags/Code+Generation/default.aspx">Code Generation</category><category domain="http://msmvps.com/blogs/kathleen/archive/tags/Visual+Basic/default.aspx">Visual Basic</category><category domain="http://msmvps.com/blogs/kathleen/archive/tags/C_2300_/default.aspx">C#</category></item><item><title>DNR TV on .NET 3.5 Languages - Part 1 Posted</title><link>http://msmvps.com/blogs/kathleen/archive/2008/01/18/dnr-tv-on-net-3-5-languages-part-1-posted.aspx</link><pubDate>Fri, 18 Jan 2008 19:55:00 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1469225</guid><dc:creator>Kathleen</dc:creator><slash:comments>4</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/kathleen/rsscomments.aspx?PostID=1469225</wfw:commentRss><comments>http://msmvps.com/blogs/kathleen/archive/2008/01/18/dnr-tv-on-net-3-5-languages-part-1-posted.aspx#comments</comments><description>&lt;p&gt;Check out &lt;a class="" href="http://www.dnrtv.com/default.aspx?showNum=97"&gt;.NET Rocks TV this week&lt;/a&gt; for the first of two parts on .NET 3.5 languages - that&amp;#39;s right C# 3.0 and VB 9 together.&amp;nbsp; It makes sense since most features cross over, and where they don&amp;#39;t you&amp;#39;ll want a handle on the differences. &lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1469225" width="1" height="1"&gt;</description><category domain="http://msmvps.com/blogs/kathleen/archive/tags/General/default.aspx">General</category><category domain="http://msmvps.com/blogs/kathleen/archive/tags/.NET/default.aspx">.NET</category><category domain="http://msmvps.com/blogs/kathleen/archive/tags/Visual+Basic/default.aspx">Visual Basic</category><category domain="http://msmvps.com/blogs/kathleen/archive/tags/C_2300_/default.aspx">C#</category></item><item><title>First Experience with Pipeline Builder</title><link>http://msmvps.com/blogs/kathleen/archive/2008/01/10/first-experience-with-pipeline-builder.aspx</link><pubDate>Fri, 11 Jan 2008 00:01:00 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1453977</guid><dc:creator>Kathleen</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/kathleen/rsscomments.aspx?PostID=1453977</wfw:commentRss><comments>http://msmvps.com/blogs/kathleen/archive/2008/01/10/first-experience-with-pipeline-builder.aspx#comments</comments><description>&lt;p class="MsoNormal" style="MARGIN:0in 0in 10pt;"&gt;&lt;font face="Calibri" size="3"&gt;Wow! &lt;/font&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN:0in 0in 10pt;"&gt;&lt;font face="Calibri" size="3"&gt;System.AddIn the easy way&lt;/font&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN:0in 0in 10pt;"&gt;Build and interface, press a button, build an add in, build a host.&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN:0in 0in 10pt;"&gt;Wow!&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN:0in 0in 10pt;"&gt;&lt;font face="Calibri" size="3"&gt;So, the pipeline builder tool really works.&lt;/font&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN:0in 0in 10pt;"&gt;&lt;font face="Calibri" size="3"&gt;You have&amp;nbsp;to&amp;nbsp;do a couple of things&amp;nbsp;not mentioned in the documentation I used. Actually the documentation needs a little work, but its there and not too bad. &lt;/font&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN:0in 0in 10pt;"&gt;&lt;font face="Calibri" size="3"&gt;Follow the directions for the VS tool&lt;/font&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN:0in 0in 10pt;"&gt;&lt;font face="Calibri" size="3"&gt;Also&lt;/font&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN:0in 0in 10pt;"&gt;&lt;font face="Calibri" size="3"&gt;Copy the Blank project to a place to work&lt;/font&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN:0in 0in 10pt;"&gt;&lt;font face="Calibri" size="3"&gt;Rename the project as desired, or test first then rename later (I am mortified by the idea of millions of &amp;quot;Blank Pipeline Project&amp;quot; assemblies floating aorund)&lt;/font&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN:0in 0in 10pt;"&gt;&lt;font face="Calibri" size="3"&gt;Add an interface to the Contracts file. It must have the AddInContract attribute and inherit from IContract. If you want to borrow mine:&lt;/font&gt;&lt;/p&gt;&lt;span style="FONT-SIZE:10pt;COLOR:blue;FONT-FAMILY:&amp;#39;Lucida Console&amp;#39;;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-no-proof:yes;"&gt;using&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Lucida Console&amp;#39;;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-no-proof:yes;"&gt; System;&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;COLOR:blue;FONT-FAMILY:&amp;#39;Lucida Console&amp;#39;;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-no-proof:yes;"&gt;using&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Lucida Console&amp;#39;;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-no-proof:yes;"&gt; System.Collections.Generic;&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;COLOR:blue;FONT-FAMILY:&amp;#39;Lucida Console&amp;#39;;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-no-proof:yes;"&gt;using&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Lucida Console&amp;#39;;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-no-proof:yes;"&gt; System.Linq;&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;COLOR:blue;FONT-FAMILY:&amp;#39;Lucida Console&amp;#39;;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-no-proof:yes;"&gt;using&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Lucida Console&amp;#39;;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-no-proof:yes;"&gt; System.Text;&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;COLOR:blue;FONT-FAMILY:&amp;#39;Lucida Console&amp;#39;;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-no-proof:yes;"&gt;using&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Lucida Console&amp;#39;;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-no-proof:yes;"&gt; System.AddIn.Contract;&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;COLOR:blue;FONT-FAMILY:&amp;#39;Lucida Console&amp;#39;;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-no-proof:yes;"&gt;using&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Lucida Console&amp;#39;;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-no-proof:yes;"&gt; PipelineHints;&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;COLOR:blue;FONT-FAMILY:&amp;#39;Lucida Console&amp;#39;;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-no-proof:yes;"&gt;using&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Lucida Console&amp;#39;;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-no-proof:yes;"&gt; System.AddIn.Pipeline;&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Lucida Console&amp;#39;;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-no-proof:yes;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Lucida Console&amp;#39;;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-no-proof:yes;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;COLOR:blue;FONT-FAMILY:&amp;#39;Lucida Console&amp;#39;;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-no-proof:yes;"&gt;namespace&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Lucida Console&amp;#39;;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-no-proof:yes;"&gt; KadGen.FirstPipelineBuilderTest.Contracts&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Lucida Console&amp;#39;;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-no-proof:yes;"&gt;{&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Lucida Console&amp;#39;;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-no-proof:yes;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;[&lt;span style="COLOR:#2b91af;"&gt;AddInContract&lt;/span&gt;()]&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Lucida Console&amp;#39;;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-no-proof:yes;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR:blue;"&gt;public&lt;/span&gt; &lt;span style="COLOR:blue;"&gt;interface&lt;/span&gt; &lt;span style="COLOR:#2b91af;"&gt;GenerateFiles&lt;/span&gt; : &lt;span style="COLOR:#2b91af;"&gt;IContract&lt;/span&gt;&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Lucida Console&amp;#39;;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-no-proof:yes;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Lucida Console&amp;#39;;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-no-proof:yes;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR:blue;"&gt;string&lt;/span&gt; GenerateForObject(&lt;span style="COLOR:blue;"&gt;string&lt;/span&gt; objectName,&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR:blue;"&gt;ref&lt;/span&gt; &lt;span style="COLOR:blue;"&gt;string&lt;/span&gt; fileName);&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Lucida Console&amp;#39;;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-no-proof:yes;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR:blue;"&gt;string&lt;/span&gt; GenerateForStoredProc(&lt;span style="COLOR:blue;"&gt;string&lt;/span&gt; objectName, &lt;span style="COLOR:blue;"&gt;ref&lt;/span&gt; &lt;span style="COLOR:blue;"&gt;string&lt;/span&gt; fileName);&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Lucida Console&amp;#39;;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-no-proof:yes;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR:blue;"&gt;string&lt;/span&gt; GenerateForDataTable(&lt;span style="COLOR:blue;"&gt;string&lt;/span&gt; objectName, &lt;span style="COLOR:blue;"&gt;ref&lt;/span&gt; &lt;span style="COLOR:blue;"&gt;string&lt;/span&gt; fileName);&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Lucida Console&amp;#39;;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-no-proof:yes;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Lucida Console&amp;#39;;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-no-proof:yes;"&gt;}&lt;/span&gt;&lt;font face="Calibri" size="3"&gt;&amp;nbsp;&lt;/font&gt; 
&lt;p class="MsoNormal" style="MARGIN:0in 0in 10pt;"&gt;&lt;font face="Calibri" size="3"&gt;If you leave off the IContract you’ll get projects but no generated cs files. Ask me how I know!&lt;/font&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN:0in 0in 10pt;"&gt;&lt;font face="Calibri" size="3"&gt;The only downside is that a lot of you will never experience the pain of creating them by hand and will be therefore so jaded that you don’t realize that the release of this tool is cause for world-wide celebrations!&lt;/font&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN:0in 0in 10pt;"&gt;&lt;font face="Calibri" size="3"&gt;I&amp;#39;ll blog about using this with VB after I&amp;#39;ve tested that more.&lt;/font&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="MARGIN:0in 0in 10pt;"&gt;&lt;font face="Calibri" size="3"&gt;&lt;/font&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1453977" width="1" height="1"&gt;</description><category domain="http://msmvps.com/blogs/kathleen/archive/tags/.NET/default.aspx">.NET</category><category domain="http://msmvps.com/blogs/kathleen/archive/tags/Sytem.AddIn/default.aspx">Sytem.AddIn</category></item></channel></rss>