<?xml version='1.0' encoding='UTF-8'?><rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/" xmlns:blogger="http://schemas.google.com/blogger/2008" xmlns:georss="http://www.georss.org/georss" xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0" version="2.0"><channel><atom:id>tag:blogger.com,1999:blog-8902397729199783860</atom:id><lastBuildDate>Fri, 14 Nov 2025 03:55:23 +0000</lastBuildDate><category>Log4Net</category><category>NHibernate</category><title>Come take a walk with me</title><description>This blog is about development and about my passion for it.&#xa;&#xa;Care to take a walk?</description><link>http://patrickdeboeck.blogspot.com/</link><managingEditor>noreply@blogger.com (Patrick)</managingEditor><generator>Blogger</generator><openSearch:totalResults>19</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8902397729199783860.post-2955975782564256403</guid><pubDate>Fri, 29 Aug 2008 19:20:00 +0000</pubDate><atom:updated>2008-08-29T21:20:49.081+02:00</atom:updated><title>Google maps support for your asp.net site</title><description>&lt;p&gt;I used the &lt;a href=&quot;http://www.asp.net/downloads/starter-kits/club/&quot; target=&quot;_blank&quot;&gt;club starter kit&lt;/a&gt; as a base website template for my &lt;a href=&quot;http://www.patrickdeboeck.com/gilsboys/&quot; target=&quot;_blank&quot;&gt;soccer team&lt;/a&gt;.&amp;#160; It has a location feature where you can put the locations of certain important events (where our next game is, where do we meet up front, where are we having drinks afterwards, etc...).&amp;#160; I though it would be nice to add support for Google maps so we can see where we&#39;ll have to play and give my teammates directions.&amp;#160; This way I would already resolve the lame excuses that they usually have for being late.&lt;/p&gt;  &lt;p&gt;At first I just looked at the &lt;a href=&quot;http://code.google.com/apis/maps/documentation/introduction.html&quot; target=&quot;_blank&quot;&gt;Google website&lt;/a&gt;.&amp;#160; Where else would you check how to integrate Google maps in your web app?&amp;#160; I found an entire &lt;a href=&quot;http://code.google.com/apis/maps/documentation/reference.html&quot; target=&quot;_blank&quot;&gt;JavaScript api&lt;/a&gt; ready for use so I started hacking away.&amp;#160; Now I must admit JavaScript is not my favorite language, I can manage but that&#39;s about it.&amp;#160; Since I believe there will be other developers just like me, someone must have written server controls for it.&amp;#160; And yes there is one available &lt;a href=&quot;http://en.googlemaps.subgurim.net/&quot; target=&quot;_blank&quot;&gt;Googlemaps.subgurim&lt;/a&gt; (Free for non commercial use)&lt;/p&gt;  &lt;p&gt;Just drag an drop the map control into your page, size it decently and put code to position the map in the page_load event handler.&amp;#160; The website contains many &lt;a href=&quot;http://en.googlemaps.subgurim.net/ejemplos/&quot; target=&quot;_blank&quot;&gt;useful and simple samples&lt;/a&gt; so I won&#39;t bore you with implementation details.&amp;#160; You can see the map in &lt;a href=&quot;http://www.patrickdeboeck.com/Gilsboys/locations_view.aspx?locationid=6&quot; target=&quot;_blank&quot;&gt;action on my soccer&#39;s team (gilsboys) website&lt;/a&gt; (click the location list hyperlink for more locations).&amp;#160; But I have to warn you if you decide to explore more of the site is in Dutch and my team is not famous for the way we play soccer but more for the drinks and parties afterwards.&amp;#160; I guess it&#39;s my way of apologizing already for the pictures that are already available :-)&lt;/p&gt;  &lt;p&gt;Check with you later !&lt;/p&gt;  </description><link>http://patrickdeboeck.blogspot.com/2008/08/google-maps-support-for-your-aspnet.html</link><author>noreply@blogger.com (Patrick)</author><thr:total>1</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8902397729199783860.post-6912635876903028233</guid><pubDate>Mon, 25 Aug 2008 22:46:00 +0000</pubDate><atom:updated>2008-08-26T00:46:19.454+02:00</atom:updated><title>Template your way into the hearts of your users !</title><description>&lt;p&gt;This week we discussed our communication strategy at work.&amp;#160; As already told previously we are writing a security service which involves creating users, adding and removing permissions and so on...&amp;#160; Any of these actions can be performed by various actors (the user himself, an administrator, some batch job, ....) and thus the user must be notified about any change!&amp;#160; Of course requirements are that the business should be able to change the emails, so hard coding them is out of the question (as always :-).&lt;/p&gt;  &lt;p&gt;I had a look at a couple of template engines this weekend to solve the problem.&amp;#160; Since I used &lt;a href=&quot;http://www.stringtemplate.org/&quot; target=&quot;_blank&quot;&gt;Stringtemplate&lt;/a&gt; &lt;a href=&quot;www.allors.com&quot; target=&quot;_blank&quot;&gt;before&lt;/a&gt; I decided to go along with that one.&amp;#160; The beauty of a template engine is that you can pass in an object graph and let the template figure out what to write and more importantly how to write it.&amp;#160; First task was to make a simple email template that could be sent to the user: &lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;div class=&quot;wlWriterSmartContent&quot; id=&quot;scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:ba5e99d9-98d0-493f-a740-21a81a6486b7&quot; style=&quot;padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px&quot;&gt;&lt;pre style=&quot;background-color:White;;overflow: auto;&quot;&gt;&lt;div&gt;&lt;!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

--&gt;&lt;span style=&quot;color: #008080; &quot;&gt; 1&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;group TemplateEmail;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt; 2&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt; 3&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;Email(person, action) ::&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt; 4&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt; 5&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;\&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;html\&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt; 6&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;\&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;body\&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt; 7&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;Dear &lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;person.name&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;,
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt; 8&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;\&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;br\&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt; 9&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;\&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;br\&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;10&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;11&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;You receive &lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;this&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; email because the following action \&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;b\&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;lt;action.Name&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; \&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;b\&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; has occurred.
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;12&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;\&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;br\&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;13&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;\&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;br\&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;14&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;15&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;This leads to changes &lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;in&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; the permissions you have on our applications.
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;16&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;\&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;br\&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;17&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;18&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;Please logon into our application to validate your permissions.
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;19&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;20&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;\&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;br\&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;21&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;\&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;br\&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;22&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;\&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;br\&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;23&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;Sincerly,
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;24&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;Patrick
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;25&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;\&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;html\&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;26&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;\&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;body\&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;27&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;!-- Code inserted with Steve Dunn&#39;s Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --&gt;&lt;/div&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;Done, this template creates a personal email with a header including the user&#39;s name and a subject containing the action that has occurred.&amp;#160; Please not that the html syntax is entirely escaped because the &amp;lt; and &amp;gt; are used to refer to parameters and other templates.&amp;#160; According to the documentation you should be able to use $ as well, but in my template these templates were never replaced.&amp;#160; Is it because the dollar is that low?&amp;#160; :-)).&amp;#160; &lt;/p&gt;

&lt;p&gt;The two templates that need replacing are &amp;lt;person.name&amp;gt; and &amp;lt;action.name&amp;gt;, the engine will try to find a property name on both of these objects (person and action), which need to be handed to the template engine.&amp;#160; (If it cannot find this, the templates results in an empty string).&amp;#160; Next we need to convert this template into a email with all values filled in, the following code does just about that:&lt;/p&gt;

&lt;div class=&quot;wlWriterSmartContent&quot; id=&quot;scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:64860d4d-2b6c-4f43-9863-20e88ed13a9c&quot; style=&quot;padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px&quot;&gt;&lt;pre style=&quot;background-color:White;;overflow: auto;&quot;&gt;&lt;div&gt;&lt;!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

--&gt;&lt;span style=&quot;color: #008080; &quot;&gt;1&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;var group &lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;new&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; StringTemplateGroup(&lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;new&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; StreamReader(&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;templates\\TemplateEmail.st&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;));
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;2&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;var template &lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; group.GetInstanceOf(&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;Email&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;);            
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;3&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;4&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;template .SetAttribute(&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;person&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;, person);
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;5&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;template .SetAttribute(&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;action&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;, action);
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;6&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;7&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;var emailBody &lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; query.ToString();&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;!-- Code inserted with Steve Dunn&#39;s Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --&gt;&lt;/div&gt;

&lt;p&gt;Again, piece of cake, if you put the result of the toString() into your email body you have nicely formatted email.&amp;#160; How did this work?&amp;#160; The first line reads the file from the disk in which the templates are stored.&amp;#160; You get a group of templates as result, you then ask it for your named template.&amp;#160; If you require attributes you can set them here by using the SetAttribute methods.&amp;#160; Finally let the template engine do its work by calling the toString() on it.&lt;/p&gt;

&lt;p&gt;All right, seems that basic templating is easy, let&#39;s switch to the next gear and divide our template into several little reusable templates.&amp;#160; After all we will want to send different mails based on what action has been performed, the type of user who has performed the action, ....&amp;#160; So let us create some templates for a mail header, mail subject and mail footer:&lt;/p&gt;

&lt;div class=&quot;wlWriterSmartContent&quot; id=&quot;scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:01b6eed7-c832-41ee-9756-0c4b311637c7&quot; style=&quot;padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px&quot;&gt;&lt;pre style=&quot;background-color:White;;overflow: auto;&quot;&gt;&lt;div&gt;&lt;!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

--&gt;&lt;span style=&quot;color: #008080; &quot;&gt; 1&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;WriteMailHeader(person) ::&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt; 2&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt; 3&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;\&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;html\&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt; 4&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;\&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;body\&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt; 5&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;\&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;div\&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt; 6&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;Dear &lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;person.name&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;,
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt; 7&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;\&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;div\&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt; 8&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;\&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;br\&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt; 9&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;\&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;br\&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;10&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;11&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;12&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;WriteMailAction(action) ::&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;13&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;14&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;You receive &lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;this&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; email because the following action \&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;b\&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;lt;action.Name&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; \&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;b\&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; has occurred.
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;15&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;\&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;br\&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;16&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;\&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;br\&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;17&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;18&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;19&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;WriteEmailFooter() ::&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;20&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;\&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;br\&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;21&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;\&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;br\&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;22&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;\&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;br\&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;23&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;Sincerly,
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;24&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;Patrick
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;25&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;\&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;html\&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;26&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;\&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;body\&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;27&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;!-- Code inserted with Steve Dunn&#39;s Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --&gt;&lt;/div&gt;

&lt;p&gt;As you can see all multi line templates start with the template name followed by the argument list.&amp;#160; The &lt;strong&gt;&lt;u&gt;::= &amp;lt;&amp;lt;&lt;/u&gt;&lt;/strong&gt; sign means the templates starts here and ends with the &lt;strong&gt;&lt;u&gt;&amp;gt;&amp;gt;&lt;/u&gt;&lt;/strong&gt; sign.&amp;#160; Our mail template can now be rewritten as follows:&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;div class=&quot;wlWriterSmartContent&quot; id=&quot;scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:b5a8ad1f-d6c8-4251-aec1-54fbbc8bf149&quot; style=&quot;padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px&quot;&gt;&lt;pre style=&quot;background-color:White;;overflow: auto;&quot;&gt;&lt;div&gt;&lt;!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

--&gt;&lt;span style=&quot;color: #008080; &quot;&gt; 1&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;group TemplateEmail;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt; 2&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt; 3&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;Email(person, action) ::&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt; 4&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;WriteEmailHeader(person)&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt; 5&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;WriteEmailAction(action)&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt; 6&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt; 7&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;This leads to changes &lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;in&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; the permissions you have on our applications.
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt; 8&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;\&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;br\&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt; 9&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;10&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;Please logon into our application to validate your permissions.
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;11&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;WriteEmailEnding()&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;12&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;13&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;!-- Code inserted with Steve Dunn&#39;s Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --&gt;&lt;/div&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;The following step is to make our mail more useful by providing extra information.&amp;#160; Lets assume that our Person has a property AuthorizationSet which holds two collections (one for the applications you are authorized to use and one for the functionalities you can execute).&amp;#160; Our template can now read these properties and act upon these values.&amp;#160; So let&#39;s add the applications and functionalities you are authorized for in the mail template.&lt;/p&gt;

&lt;div class=&quot;wlWriterSmartContent&quot; id=&quot;scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:243d775f-a662-46ac-99b6-644050ab99f9&quot; style=&quot;padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px&quot;&gt;&lt;pre style=&quot;background-color:White;;overflow: auto;&quot;&gt;&lt;div&gt;&lt;!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

--&gt;&lt;span style=&quot;color: #008080; &quot;&gt; 1&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;WriteApplicationInformation(person) ::&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt; 2&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;You have access to the following applications:
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt; 3&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;\&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;ul\&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt; 4&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;person.AuthorizationSet.Applications:{application&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;|&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;WriteApplicationInformationLine(application)&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;}; separator&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt; 5&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;\&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;ul\&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt; 6&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt; 7&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt; 8&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;WriteApplicationInformationLine(application) ::&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt; 9&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;\&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;li\&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;application.Name&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; of type &lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;application.Type&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; valid from &lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;application.StartDate&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; till &lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;application.EndDate&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;  \&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;li\&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;10&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;11&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;12&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;WriteFunctionalityInformation(person) ::&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;13&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;You have access to the following functionalities:
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;14&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;\&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;ul\&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;15&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;person.AuthorizationSet.Functionalities:{functionality&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;|&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;WriteFunctionalityInformationLine(functionality)&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;}; separator&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;16&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;\&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;ul\&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;17&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;18&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;19&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;WriteFunctionalityInformationLine(functionality) ::&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;20&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;\&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;li\&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;functionality.Name&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; with code &lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;functionality.Code&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; valid from &lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;functionality.StartDate&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; till &lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;functionality.EndDate&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; \&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;li\&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;21&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;22&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;23&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;!-- Code inserted with Steve Dunn&#39;s Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --&gt;&lt;/div&gt;

&lt;p&gt;And you simply call these templates with the following 2 lines in your email template:&lt;/p&gt;

&lt;div class=&quot;wlWriterSmartContent&quot; id=&quot;scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:72f4d006-7e13-47ae-b452-dcde9596b45d&quot; style=&quot;padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px&quot;&gt;&lt;pre style=&quot;background-color:White;;overflow: auto;&quot;&gt;&lt;div&gt;&lt;!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

--&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;WriteApplicationInformation(person)&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;WriteFunctionalityInformation(person)&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;!-- Code inserted with Steve Dunn&#39;s Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --&gt;&lt;/div&gt;

&lt;p&gt;Let&#39;s go a little bit deeper in the previous templates we&#39;ve seen, shall we!&amp;#160; We have created 4 sub templates, two for application permissions (WriteApplicationInformation and WriteApplicationInformationLine) and two for functionality permissions (WriteFunctionalityInformation and WriteFunctionalityInformationLine).&amp;#160; The main template calls the line template for each item.&amp;#160; This is achieved by the following syntax: &amp;lt; property : { subtemplate }; separator = &amp;quot;\n&amp;quot;&amp;gt;,.&amp;#160; This means that for each property (if it is an array, otherwise it will be called only once) the subtemplate is called, the &amp;quot;\n&amp;quot; character will be used in the template between every iterated call.&amp;#160; The subtemplate has the following pattern { parameter | &amp;lt;template(parameter)&amp;gt;}.&amp;#160; First you name the value for each iterated object, then you specify what other named template to call (or use an inline template).&lt;/p&gt;

&lt;p&gt;Finally I would like to add extra information on the items depending on the value we have in the permission sets.&amp;#160; Every permission has a start date and an end date.&amp;#160; These are shown as well, but now when a permission has an end date set to sometime far in the future, it doesn&#39;t really add any extra value.&amp;#160; On top of that it looks unprofessional too, so let&#39;s us vary the template based on wether we have a permission that is open ended.&amp;#160; First add an extra property in your permission class IsOpenEnded that returns true/false based on the EndDate == DateTime.MaxValue.&amp;#160; Then make an if structure in your template depending on this property.&amp;#160; If we have an open end, we simply make do not display the end date, but show a slightly different text.&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;div class=&quot;wlWriterSmartContent&quot; id=&quot;scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:b844540f-561f-427c-944a-e3353584c1cb&quot; style=&quot;padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px&quot;&gt;&lt;pre style=&quot;background-color:White;;overflow: auto;&quot;&gt;&lt;div&gt;&lt;!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

--&gt;&lt;span style=&quot;color: #008080; &quot;&gt; 1&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;WriteApplicationInformationLine(application) ::&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt; 2&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;\&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;li\&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; 
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt; 3&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;application.Name&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; of type &lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;application.Type&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; 
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt; 4&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;(application.IsOpenEnded)&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt; 5&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;        valid from &lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;application.StartDate&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; till piggs can fly  
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt; 6&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;else&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt; 7&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;        valid from &lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;application.StartDate&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; till &lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;application.EndDate&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;  
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt; 8&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;endif&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;    
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt; 9&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;\&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;li\&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;10&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;!-- Code inserted with Steve Dunn&#39;s Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --&gt;&lt;/div&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;So now we have a nice looking email that communicates everything we want with just providing an object tree to our template.&amp;#160; But of course that doesn&#39;t suffice.&amp;#160; We want to be able to differentiate templates between the action we have performed, that was one of the reasons why we created the small templates remember.&amp;#160; So if we modify the code where we load our template, we can choose a different template based on the action we had. &lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;
  &lt;div class=&quot;wlWriterSmartContent&quot; id=&quot;scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:8007c7ec-df98-4fd7-a38e-1ac086bad918&quot; style=&quot;padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px&quot;&gt;&lt;pre style=&quot;background-color:White;;overflow: auto;&quot;&gt;&lt;div&gt;&lt;!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

--&gt;&lt;span style=&quot;color: #008080; &quot;&gt;1&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;var group &lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;new&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; StringTemplateGroup(&lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;new&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; StreamReader(&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;templates\\TemplateEmail.st&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;));
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;2&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;var template &lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; group.GetInstanceOf(&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;EmaiForl&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;action.Type);            
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;3&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;4&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;template .SetAttribute(&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;person&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;, person);
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;5&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;template .SetAttribute(&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;action&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;, action);
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;6&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;7&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;var emailBody &lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; query.ToString();&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;!-- Code inserted with Steve Dunn&#39;s Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --&gt;&lt;/div&gt;
&lt;/p&gt;

&lt;p&gt;This means we need to have templates for the different actionTypes our application has, in our case these two templates would be required:&lt;/p&gt;

&lt;div class=&quot;wlWriterSmartContent&quot; id=&quot;scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:aed9e17d-cf30-498a-91f0-ee1e1198779a&quot; style=&quot;padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px&quot;&gt;&lt;pre style=&quot;background-color:White;;overflow: auto;&quot;&gt;&lt;div&gt;&lt;!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

--&gt;&lt;span style=&quot;color: #008080; &quot;&gt; 1&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;EmailForChangeAuthorization(person, action) ::&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt; 2&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;WriteEmailHeader(person)&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt; 3&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;WriteEmailAction(action)&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt; 4&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;\&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;br\&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt; 5&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;This leads to changes &lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;in&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; the permissions you have on our applications.
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt; 6&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;\&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;br\&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt; 7&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;WriteApplicationInformation(person)&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt; 8&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;WriteFunctionalityInformation(person)&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt; 9&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;10&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;WriteEmailEnding()&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;11&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;12&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;13&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;EmailForChangePassword(person, action) ::&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;14&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;WriteEmailHeader(person)&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;15&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;WriteEmailAction(action)&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;16&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;17&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;We are glad to inform you that your &lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;new&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; password &lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;is&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;MakeBold(person.password)&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;, please 
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;18&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;logon and change your password to something more personal.
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;19&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;20&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;WriteEmailEnding()&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;21&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;!-- Code inserted with Steve Dunn&#39;s Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --&gt;&lt;/div&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;That pretty much it.&amp;#160; If you want to have a look at it yourself, you can &lt;a href=&quot;http://www.patrickdeboeck.com/resources/Stringtemplate.zip&quot; target=&quot;_blank&quot;&gt;download the code&lt;/a&gt; or go have a look at the he &lt;a href=&quot;http://www.stringtemplate.org/&quot; target=&quot;_blank&quot;&gt;Stringtemplate&lt;/a&gt; website.&lt;/p&gt;  </description><link>http://patrickdeboeck.blogspot.com/2008/08/template-your-way-into-hearts-of-your.html</link><author>noreply@blogger.com (Patrick)</author><thr:total>2</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8902397729199783860.post-9106412604637783213</guid><pubDate>Sat, 02 Aug 2008 21:20:00 +0000</pubDate><atom:updated>2008-08-05T22:25:01.458+02:00</atom:updated><title>Simplify your life... decorate with aspects !</title><description>&lt;p&gt;In the company that currently hired me tracing for instance (which is one of the areas you could benefit a lot from using aspects), is done my hand.&amp;#160; Every method (at least most of them)&amp;#160; follows the next format&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;div class=&quot;wlWriterSmartContent&quot; id=&quot;scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:d071a895-accc-4451-a729-788fb66f2a0a&quot; style=&quot;padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; width: 1033px; padding-top: 0px&quot;&gt;&lt;pre style=&quot;background-color:White;;overflow: auto;&quot;&gt;&lt;div&gt;&lt;!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

--&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;public&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;bool&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; Method(&lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;params&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;string&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;[] inputValues) 
{
  Trace(&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;Enter&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;MethodName&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;, inputValues); &lt;/span&gt;&lt;span style=&quot;color: #008000; &quot;&gt;//&lt;/span&gt;&lt;span style=&quot;color: #008000; &quot;&gt; trace all input parameters&lt;/span&gt;&lt;span style=&quot;color: #008000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;
  .....
  &lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;bool&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; someValue;
  ......

  Trace(&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;Exit&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;MethodName&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;, someValue); &lt;/span&gt;&lt;span style=&quot;color: #008000; &quot;&gt;//&lt;/span&gt;&lt;span style=&quot;color: #008000; &quot;&gt; trace parameters leaving the method&lt;/span&gt;&lt;span style=&quot;color: #008000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;return&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; someValue
}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;!-- Code inserted with Steve Dunn&#39;s Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --&gt;&lt;/div&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;If you only have to write code once and then never touch it again, maybe this way of developing would be acceptable.&amp;#160; But I rarely (read never) have been on a project where this was true.&amp;#160; Code will be refactorred and not only once.&amp;#160; Keeping the tracing parameters in sync with the constant refactorings is something that is often forgotten.&amp;#160; Compare it with the method documentation you write, if you would generate your ndoc now does it truly reflect your code??&amp;#160; My thoughts exactly, so help is needed, aspect orientation to the rescue.&amp;#160; If you &lt;a href=&quot;http://www.google.be/search?hl=nl&amp;amp;q=aspect+orientation&amp;amp;btnG=Google+zoeken&amp;amp;meta=&quot; target=&quot;_blank&quot;&gt;Google aspect orientation&lt;/a&gt; (that&#39;s right I even saved you the time to do that) you will find many useful resources and implementations, today I will be taking a closer look into &lt;a href=&quot;http://www.postsharp.org/&quot; target=&quot;_blank&quot;&gt;PostSharp&lt;/a&gt;.&amp;#160; &lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://www.postsharp.org/&quot; target=&quot;_blank&quot;&gt;PostSharp&lt;/a&gt; performs a post compilation step to inject IL code, which means it can &#39;adapt&#39; your entire code base even private methods,fields...&amp;#160; You can use &lt;a href=&quot;http://www.postsharp.org/&quot; target=&quot;_blank&quot;&gt;PostSharp&lt;/a&gt; in two ways, the easiest is to download the msi file and install it on your machine.&amp;#160; If you are anything like me you hate installing software on your machine, you might have a look at &lt;a href=&quot;http://www.postsharp.org/blog/2008/01/under-hood-of-msbuild-integration.html&quot; target=&quot;_blank&quot;&gt;this blog&lt;/a&gt; post from Gael Fraiteur the lead developer for the project.&amp;#160; He explains what happens under the hood and how the post compile step is called in msbuild.&amp;#160;&amp;#160;&amp;#160; &lt;/p&gt;

&lt;p&gt;If now you add the required assemblies (PostSharp.public and optionally PostSharp.Laos) to your project, the post compilation step will automatically gets called from msbuild.&amp;#160; It will search your assembly for all required tasks to process and then updates the IL code. &lt;/p&gt;

&lt;p&gt;First on my list is to improve my above tracing problem.&amp;#160; This is easily solved by overriding the OnMethodBoundaryAspect (provided as one of the higher level aspects of the PostSharp.Laos library) , this provides the following methods: &lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;OnEntry : called when entering the method &lt;/li&gt;

  &lt;li&gt;OnExit : always called when exiting a method &lt;/li&gt;

  &lt;li&gt;OnException: called when the method resulted in an exception &lt;/li&gt;

  &lt;li&gt;OnSuccess: called when the method executed successfully &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;and leads to the following code:&lt;/p&gt;

&lt;div class=&quot;wlWriterSmartContent&quot; id=&quot;scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:6ce51bbd-6da8-44d1-b82d-36298cd5eb5a&quot; style=&quot;padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; width: 1567px; padding-top: 0px&quot;&gt;&lt;pre style=&quot;background-color:White;;overflow: auto;&quot;&gt;&lt;div&gt;&lt;!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

--&gt;&lt;span style=&quot;color: #000000; &quot;&gt;        &lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;public&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;override&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;void&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; OnEntry(MethodExecutionEventArgs eventArgs)
        {
            Trace.WriteLine(
                &lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;string&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;.Format(&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;Enter {0}.{1}.&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;, typename, methodname),
                &lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;this&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;.category);
        }

        &lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;public&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;override&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;void&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; OnExit(MethodExecutionEventArgs eventArgs)
        {
            Trace.WriteLine(
                &lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;string&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;.Format(&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;Leaving {0}.{1} with {2}&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;,
                               typename,
                               methodname,
                               eventArgs.ReturnValue),
                &lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;this&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;.category);            
        }

        &lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;public&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;override&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;void&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; OnException(MethodExecutionEventArgs eventArgs)
        {
            Trace.WriteLine(
                &lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;string&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;.Format(&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;Exception {0}.{1}.&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;,
                               eventArgs.Exception.Message,
                               eventArgs.Exception.StackTrace),
                &lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;this&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;.category);
        }
        
        &lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;public&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;override&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;void&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; OnSuccess(MethodExecutionEventArgs eventArgs)
        {
            &lt;/span&gt;&lt;span style=&quot;color: #008000; &quot;&gt;//&lt;/span&gt;&lt;span style=&quot;color: #008000; &quot;&gt; Usually you don&#39;t need this&lt;/span&gt;&lt;span style=&quot;color: #008000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;        }&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;!-- Code inserted with Steve Dunn&#39;s Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --&gt;&lt;/div&gt;

&lt;p&gt;Another way to achieve this is to override the &lt;code&gt;OnMethodInvocation&lt;/code&gt;.&amp;#160; This provides you with different methods to work with but you have the same functionality at your disposal.&amp;#160; The major difference is that this method does not modify your original method (as would happen with the above sample), but intercepts the call en invokes your OnInvocation method).&amp;#160; Check reflector to see the differences here!!&lt;/p&gt;

&lt;div class=&quot;wlWriterSmartContent&quot; id=&quot;scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:a4fc7df8-c28c-4c0e-967c-7eaeea6d8939&quot; style=&quot;padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px&quot;&gt;&lt;pre style=&quot;background-color:White;;overflow: auto;&quot;&gt;&lt;div&gt;&lt;!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

--&gt;&lt;span style=&quot;color: #000000; &quot;&gt;        &lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;public&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;override&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;void&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; OnInvocation(MethodInvocationEventArgs eventArgs)
        {
            &lt;/span&gt;&lt;span style=&quot;color: #008000; &quot;&gt;//&lt;/span&gt;&lt;span style=&quot;color: #008000; &quot;&gt; Perform tracing here&lt;/span&gt;&lt;span style=&quot;color: #008000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;            Trace.WriteLine(
                &lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;string&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;.Format(&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;Enter {0}.{1}.&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;, typename, methodname),
                &lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;this&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;.category);

            &lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;try&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;
            {
                &lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;base&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;.OnInvocation(eventArgs); &lt;/span&gt;&lt;span style=&quot;color: #008000; &quot;&gt;//&lt;/span&gt;&lt;span style=&quot;color: #008000; &quot;&gt; Invoke your method here!&lt;/span&gt;&lt;span style=&quot;color: #008000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;            } 
            &lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;catch&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;(Exception ex)
            {
                Trace.WriteLine(
                &lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;string&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;.Format(&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;Exception {0}.{1}.&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;,
                               ex.Message,
                               ex.StackTrace),
                &lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;this&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;.category);
            }
            &lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;finally&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;
            {
                Trace.WriteLine(
                           &lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;string&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;.Format(&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;Leaving {0}.{1} with {2}&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;,
                                          typename,
                                          methodname,
                                          eventArgs.ReturnValue),
                           &lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;this&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;.category);
            }            
        }&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;!-- Code inserted with Steve Dunn&#39;s Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --&gt;&lt;/div&gt;

&lt;p&gt;So far so good.&amp;#160; Applying these attributes is as simple as using other attributes in .NET, just decorate your method/class with them.&amp;#160; If off course you wish to perform tracing on an entire assembly or part of it, You will be adding a lot of these attributes, so a better way has been provided:&amp;#160; The following configuration intercepts all method calls from the Tracing.Model, Tracing.Repository and Tracing.Service namespace.&amp;#160;&amp;#160;&amp;#160; You could tweak this further.&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;
  &lt;div class=&quot;wlWriterSmartContent&quot; id=&quot;scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:87442cc7-3e0a-491b-9485-c4af521cc6c5&quot; style=&quot;padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px&quot;&gt;&lt;pre style=&quot;background-color:White;;overflow: auto;&quot;&gt;&lt;div&gt;&lt;!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

--&gt;&lt;span style=&quot;color: #000000; &quot;&gt;[assembly: Trace(AttributeTargetTypes &lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;Tracing.Model.*&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;)]
[assembly: Trace(AttributeTargetTypes &lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;Tracing.Repository.*&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;)]
[assembly: Trace(AttributeTargetTypes &lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;Tracing.Service.*&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;)]&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;!-- Code inserted with Steve Dunn&#39;s Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --&gt;&lt;/div&gt;
&lt;/p&gt;

&lt;p&gt;You could specify on which the aspects (or attributes) can be applied by specifying the AttributeUsage and MulticastAttributeUsage, see the official documentation about that &lt;a href=&quot;http://doc.postsharp.org/1.0/&quot; target=&quot;_blank&quot;&gt;here (UserGuide -&amp;gt; Using PostSharp LAOS -&amp;gt; Wildcards and multicasting)&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;Secondly my I wanted to simplify my validation code.&amp;#160; One solution is to decorate my fields with the specification they have to obey.&amp;#160; For instance &lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;A String field should contains maximally 16 characters &lt;/li&gt;

  &lt;li&gt;A Number must be between 1-100 (see the following code sample) &lt;/li&gt;

  &lt;li&gt;A Date must be in the future &lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;wlWriterSmartContent&quot; id=&quot;scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:eee6c578-bb95-49dd-a42b-a30e65dcd804&quot; style=&quot;padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px&quot;&gt;&lt;pre style=&quot;background-color:White;;overflow: auto;&quot;&gt;&lt;div&gt;&lt;!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

--&gt;&lt;span style=&quot;color: #000000; &quot;&gt; [Serializable]
    &lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;public&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;class&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; RangeSpecification : OnFieldAccessAspect 
    {
        &lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;public&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; Int32 _minimum &lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;;
        &lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;public&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; Int32 _maximum &lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;100&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;;

        &lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;public&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; RangeSpecification(Int32 minimum, Int32 maximum)
        {
            _minimum &lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; minimum;
            _maximum &lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; maximum;
        }

        &lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;public&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;override&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;bool&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; CompileTimeValidate(System.Reflection.FieldInfo field)
        {
            Console.WriteLine(&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;RangeSpecification&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;); &lt;/span&gt;&lt;span style=&quot;color: #008000; &quot;&gt;//&lt;/span&gt;&lt;span style=&quot;color: #008000; &quot;&gt; this comes in the output window when compiling&lt;/span&gt;&lt;span style=&quot;color: #008000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;
            &lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; (field.FieldType.Name &lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;!=&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;typeof&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;(Int32).Name)            
            {
                &lt;/span&gt;&lt;span style=&quot;color: #008000; &quot;&gt;//&lt;/span&gt;&lt;span style=&quot;color: #008000; &quot;&gt; &amp;quot;Why would you want to use this specification on a non number field?&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #008000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;                &lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;return&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;false&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;;
            }
            &lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;return&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;true&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;;
        }

        &lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;public&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;override&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;void&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; OnSetValue(FieldAccessEventArgs eventArgs)
        {
            Int32 exposedValue &lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; Int32.Parse(eventArgs.ExposedFieldValue.ToString());
            &lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; (exposedValue &lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; _minimum &lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;||&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; exposedValue &lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; _maximum)
            {
                &lt;/span&gt;&lt;span style=&quot;color: #008000; &quot;&gt;//&lt;/span&gt;&lt;span style=&quot;color: #008000; &quot;&gt; keep the old value when an invalid value was passed in&lt;/span&gt;&lt;span style=&quot;color: #008000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;                eventArgs.ExposedFieldValue &lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; eventArgs.StoredFieldValue;                
            }            

            &lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;base&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;.OnSetValue(eventArgs);
        }
    }&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;!-- Code inserted with Steve Dunn&#39;s Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --&gt;&lt;/div&gt;

&lt;p&gt;So far the first exploration of PostSharp, I&amp;#160; realize this was only the top of the possibilities but I hope everybody can see how much code can be saved and might not clutter your production code by applying these aspects correctly in your code.&lt;/p&gt;

&lt;p&gt;See you next time.&lt;/p&gt;  </description><link>http://patrickdeboeck.blogspot.com/2008/08/simplify-your-life-decorate-with.html</link><author>noreply@blogger.com (Patrick)</author><thr:total>4</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8902397729199783860.post-3855812874776478293</guid><pubDate>Tue, 29 Jul 2008 21:45:00 +0000</pubDate><atom:updated>2008-07-29T23:45:40.787+02:00</atom:updated><title>Ignore files in your subversion repository</title><description>&lt;p&gt;After reading the &lt;a href=&quot;http://en.wikipedia.org/wiki/The_Pragmatic_Programmer&quot; target=&quot;_blank&quot;&gt;pragmatic programmer&lt;/a&gt; in my holiday I decided it was time to put theory into practice.&amp;#160; Whenever I perform an check-in in my &lt;a href=&quot;http://subversion.tigris.org/&quot; target=&quot;_blank&quot;&gt;subversion&lt;/a&gt; repository I usually deleted my bin and obj folders manually to make sure they didn&#39;t got checked-in.&amp;#160; Of course &lt;a href=&quot;http://tortoisesvn.tigris.org/&quot; target=&quot;_blank&quot;&gt;tortoiseSVN&lt;/a&gt; and subversion provides ways to automatically exclude them when you check-in.&lt;/p&gt;  &lt;p&gt;So in order to &#39;avoid my repetitive tasks&#39; and win those crucial couple of seconds on every commit (have you ever count how much this could add-up to on a year basis?) I browsed the tortoise site and found the following documentation:&lt;/p&gt;  &lt;p&gt;&lt;a title=&quot;http://tortoisesvn.net/docs/nightly/TortoiseSVN_en/ch05s11.html#tsvn-DUG-ignore-glob&quot; href=&quot;http://tortoisesvn.net/docs/nightly/TortoiseSVN_en/ch05s11.html#tsvn-DUG-ignore-glob&quot;&gt;http://tortoisesvn.net/docs/nightly/TortoiseSVN_en/ch05s11.html#tsvn-DUG-ignore-glob&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Here are the settings that I&#39;ve applied on my projects : &lt;strong&gt;*/bin */obj */_ReSharper* *.suo *.user *.resharper&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href=&quot;http://lh5.ggpht.com/Gilsboys11/SI-PgoCLCfI/AAAAAAAAADE/iMKDrcW9C_U/s1600-h/image%5B2%5D.png&quot;&gt;&lt;img style=&quot;border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px&quot; height=&quot;160&quot; alt=&quot;image&quot; src=&quot;http://lh3.ggpht.com/Gilsboys11/SI-PhKxf08I/AAAAAAAAADI/tzjV04V629M/image_thumb.png?imgmax=800&quot; width=&quot;244&quot; border=&quot;0&quot; /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Right where can I win some more time, maybe I can achieve my &lt;a href=&quot;http://www.fourhourworkweek.com/&quot; target=&quot;_blank&quot;&gt;4 hour work week&lt;/a&gt;!&lt;/p&gt;  </description><link>http://patrickdeboeck.blogspot.com/2008/07/ignore-files-in-your-subversion.html</link><author>noreply@blogger.com (Patrick)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh3.ggpht.com/Gilsboys11/SI-PhKxf08I/AAAAAAAAADI/tzjV04V629M/s72-c/image_thumb.png?imgmax=800" height="72" width="72"/><thr:total>2</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8902397729199783860.post-6386200001010322</guid><pubDate>Mon, 07 Jul 2008 16:30:00 +0000</pubDate><atom:updated>2008-07-07T18:30:55.346+02:00</atom:updated><title>Book Reviews: the holiday books</title><description>&lt;p&gt;Just returned from my holiday where I had the time to catch up on my reading. I choose a couple of books from my &lt;a href=&quot;http://www.shelfari.com/o1518083567&quot; target=&quot;_blank&quot;&gt;shelf&lt;/a&gt; and went on my way to France. &lt;/p&gt;  &lt;table cellspacing=&quot;0&quot; cellpadding=&quot;2&quot; width=&quot;100%&quot; border=&quot;0&quot;&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td valign=&quot;top&quot; width=&quot;172&quot;&gt;&lt;center&gt;&lt;img src=&quot;http://ecx.images-amazon.com/images/I/41kRagsFGDL._SL500_BO2,204,203,200_PIlitb-dp-500-arrow,TopRight,45,-64_OU01_AA240_SH20_.jpg&quot; /&gt;&lt;/center&gt;&lt;/td&gt;        &lt;td valign=&quot;top&quot; width=&quot;1363&quot;&gt;&lt;strong&gt;The pragmatic programmer&lt;/strong&gt;           &lt;p&gt;This book is all about becoming a better and more productive developer.&amp;#160; The book contains tips and tricks to let you focus on the job at hand instead of distracting you from it.&amp;#160; It reads like a novel so it is perfect as holiday lecture (buy this book if you are leaving in the next couple of weeks).&lt;/p&gt;          &lt;p&gt;I simply cannot believe that this book is written 10 years ago.&amp;#160; It still is burning accurate and besides the referral to the &amp;quot;upcoming language of &lt;a href=&quot;http://java.sun.com/&quot; target=&quot;_blank&quot;&gt;java&lt;/a&gt;&amp;quot; and &amp;quot;in the future there will be &lt;a href=&quot;http://www.refactoring.com/tools.html&quot; target=&quot;_blank&quot;&gt;refactorings tools&lt;/a&gt; available&amp;quot; you simply cannot tell it is this &#39;old&#39;.&amp;#160; &lt;/p&gt;          &lt;p&gt;I really liked the way the book compared the continuously studying everyone has to do with investing in your stock portfolio, it&#39;s all about diversification!&amp;#160; &lt;/p&gt;          &lt;p&gt;As a nice extra for one of my colleagues&amp;#160; the books describes nicely the pussy way of development.&amp;#160; :-) &lt;/p&gt;          &lt;p&gt;&lt;/p&gt;       &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign=&quot;top&quot; width=&quot;172&quot;&gt;&lt;center&gt;&lt;img src=&quot;http://ecx.images-amazon.com/images/I/51Y57BH27TL._SL500_AA240_.jpg&quot; /&gt; &lt;/center&gt;&lt;/td&gt;        &lt;td valign=&quot;top&quot; width=&quot;1363&quot;&gt;&lt;strong&gt;Agile principles, patterns and practices in C#&lt;/strong&gt;           &lt;br /&gt;          &lt;br /&gt;A must read book for everyone doing agile development in C#.&amp;#160; It starts of with a section explaining what agile development is all about and what are its cornerstones.&amp;#160; The section ends with an hilarious &#39;role play story on pair programming&#39;.&amp;#160; &lt;br /&gt;          &lt;br /&gt;The second section is more interesting where all the basic principles of software development pas the revue.&amp;#160; If you don&#39;t know what the &lt;a href=&quot;http://en.wikipedia.org/wiki/Single_responsibility_principle&quot; target=&quot;_blank&quot;&gt;Single Responsibility&amp;#160; principle&lt;/a&gt;, what the &lt;a href=&quot;http://en.wikipedia.org/wiki/Open/closed_principle&quot; target=&quot;_blank&quot;&gt;open/closed principle&lt;/a&gt; has to do when there are no doors involved, when &lt;a href=&quot;http://en.wikipedia.org/wiki/Liskov_substitution_principle&quot; target=&quot;_blank&quot;&gt;LSP&lt;/a&gt;, DIP and ISP are just meaningless acronyms then this book is for you.&amp;#160; The section finishes of with an overview of UML and how to express design in various diagrams.           &lt;br /&gt;          &lt;br /&gt;Section three and four covers the patterns part of the book and it does this by following a case study about a payroll system.&amp;#160; If you have heard of NDepend you will probably be familiar with the principles (REP, CRP, ....) Robert explains when packaging our case study.           &lt;br /&gt;          &lt;br /&gt;I would advice this book to everyone who wants to start with agile development!&lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;I then started to read &lt;a href=&quot;http://www.amazon.com/Implementation-Patterns-Addison-Wesley-Signature-Kent/dp/0321413091&quot; target=&quot;_blank&quot;&gt;Implementation patterns&lt;/a&gt; from Kent Beck, but the didn&#39;t finish it yet.&amp;#160; The swimming pool looked more appealing...&lt;/p&gt;  </description><link>http://patrickdeboeck.blogspot.com/2008/07/book-reviews-holiday-books.html</link><author>noreply@blogger.com (Patrick)</author><thr:total>2</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8902397729199783860.post-4423653106755263328</guid><pubDate>Thu, 12 Jun 2008 20:09:00 +0000</pubDate><atom:updated>2008-06-12T23:38:23.873+02:00</atom:updated><title>The pain of development in Vista</title><description>&lt;p&gt;I recently bought a new laptop with Windows Vista already pre-installed.&amp;#160; Until that time my development machine was running on XP, but now I had the joy of meeting the latest invention (??) of Microsoft called User Access Control (UAC)!&amp;#160; I am still figuring out if this is supposed to be feature or a bug that the programmers could not fix.&amp;#160; &lt;/p&gt;  &lt;p&gt;My problem is the following: Whenever I open a perfectly working solution on my new machine I got an annoying &amp;quot;System.Runtime.InteropServices.COMException&amp;quot; exception hitting me.&amp;#160; I quickly realized it happened only when accessing a Web or Service through IIS.&amp;#160; Whenever you want to access local IIS Website your Visual Studio needs to fired up in the context of an administrator, by default Vista starts applications in a limited-privilege user account.&amp;#160; The solution to this problems is relatively easy, always start your studio in administrator mode.&amp;#160; I created a new shortcut that runs in administrator mode and associated my sln-files to use this shortcut by default.&amp;#160; If you right-click on a shortcut, in the advanced tab you can select the &#39;run in administrator&#39; option.&lt;/p&gt;  &lt;p&gt;Problem solved if you can live with a UAC popup every time you open Visual Studio.&amp;#160; If you anything like me you want to avoid this popup as well :-), my first thought was simply disable the UAC Altogether, but then other features might stop working because windows believes your system is not trustworthy.&amp;#160; Since I usually select proceed in those useless popups I decided to accept this silently without prompting, you can read &lt;a href=&quot;http://www.informationweek.com/blog/main/archives/2007/06/dont_shut_off_v.html&quot; target=&quot;_blank&quot;&gt;here&lt;/a&gt; how this can be achieved.&amp;#160; I took the liberty of giving you summary here:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;Click Start and Control Panel. Switch to Classic View (if you haven&#39;t already) and click on the Administration Tools icon. In the list that opens click on Local Security Policy, and in the next window, Local Policies (a tiny bit redundant, but all UIs can&#39;t be perfect -- If UAC is running you&#39;ll get a UAC pop-up somewhere in here). In the Local Policies list click Security Options, and scroll down to &amp;quot;User Account Control: Behavior&amp;quot; (the full title of the policy is &amp;quot;User Account Control: Behavior of the elevation prompt for administrators in Admin Approval Mode&amp;quot; but the window barely opens that far). Double-click the title and in the dialog box change its setting from &amp;quot;Prompt for Consent&amp;quot; to &amp;quot;Elevate without prompting.&amp;quot; Click OK and the urge to tear your hair and scream at your PC will be greatly diminished in the future.&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;I hope this post will save you time and headache, till next time.&lt;/p&gt;  </description><link>http://patrickdeboeck.blogspot.com/2008/06/pains-of-development-in-vista.html</link><author>noreply@blogger.com (Patrick)</author><thr:total>5</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8902397729199783860.post-7953279363942635472</guid><pubDate>Thu, 05 Jun 2008 19:01:00 +0000</pubDate><atom:updated>2008-06-05T21:01:21.035+02:00</atom:updated><title>NHibernate in Action: Book Review</title><description>&lt;p&gt;I finished this &lt;a href=&quot;http://www.manning.com/kuate/&quot; target=&quot;_blank&quot;&gt;&#39;beta&#39; book&lt;/a&gt; today, it took me a while because I have the bad habit of reading multiple books at the same time.&amp;#160; For an NHibernate virgin like myself the book was a very good introduction. It covers everything you need to know to get started with release 1.2.1 version, although nothing is inserted (yet ?? ) for the upcoming 2.0 release.&amp;#160; I hope the final version will include some chapters covering the new features, especially the event/listener model seems to be interesting.&amp;#160; If it doesn&#39;t the book might already be outdated upon its release in August.&lt;/p&gt;  &lt;p&gt;The thing I was missing was more in depth information about extending the functionality of NHibernate.&amp;#160; We had an issue for instance with the interceptors which you can read all about &lt;a href=&quot;http://patrickdeboeck.blogspot.com/2008/05/nhibernate-optimistic-locking-where-did.html&quot; target=&quot;_blank&quot;&gt;here&lt;/a&gt;, but the book did not provide a lot of information about.&amp;#160; &lt;/p&gt;  &lt;p&gt;My overall conclusion is positive because it was a nice intro, but if you already have some experience with NHibernate the book&amp;#160; might be too &#39;easy&#39; for you.&lt;/p&gt;  </description><link>http://patrickdeboeck.blogspot.com/2008/06/nhibernate-in-action-book-review.html</link><author>noreply@blogger.com (Patrick)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8902397729199783860.post-8776509622086472178</guid><pubDate>Wed, 04 Jun 2008 14:58:00 +0000</pubDate><atom:updated>2008-06-04T16:58:27.247+02:00</atom:updated><title>Big twitter is watching you.... or me</title><description>&lt;p&gt;I finally got the &#39;stalking decease&#39; as well and subscribed to twitter.&amp;#160; You can follow me &lt;a href=&quot;http://twitter.com/patrickdeboeck&quot; target=&quot;_blank&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;  </description><link>http://patrickdeboeck.blogspot.com/2008/06/big-twitter-is-watching-you-or-me.html</link><author>noreply@blogger.com (Patrick)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8902397729199783860.post-6641240134583042863</guid><pubDate>Sat, 31 May 2008 21:32:00 +0000</pubDate><atom:updated>2008-05-31T23:53:10.119+02:00</atom:updated><title>DDAD: Domain Driven &amp;quot;Allors&amp;quot; Design</title><description>&lt;p&gt;As explained in my &lt;a href=&quot;http://patrickdeboeck.blogspot.com/2008/04/my-open-source-project.html&quot; target=&quot;_blank&quot;&gt;previous post&lt;/a&gt; I am going to build an application to demonstrate what Allors is and how to use it.&amp;#160; I will hopefully have to time to build the same application later on using NHibernate to show both frameworks differences.&amp;#160; &lt;/p&gt;  &lt;p&gt;The application I&#39;ll be building will take care of the invoicing for a contractor.&amp;#160; It is built using the &lt;a href=&quot;http://en.wikipedia.org/wiki/You_Ain&#39;t_Gonna_Need_It&quot; target=&quot;_blank&quot;&gt;YAGNI&lt;/a&gt; principle (this basically states if you think you need to add complexity to your domain model, you should defer it until the moment you actually need it.&amp;#160; Probably you ain&#39;t gonna).&amp;#160; Lets discuss the domain shall we.&amp;#160; The most important class obviously is the Contract signed between a Customer and a contractors&#39;s Company.&amp;#160; Both the customer and the company are subclasses of the corporation class, which gives them some common attributes (like Name, Address, Account, .... ).&amp;#160; On the Contract you can then register the hours you worked for them and eventually generate an Invoice for a specific period.&amp;#160; &lt;/p&gt;  &lt;p&gt;All relations and classes are shown in the following model: &lt;/p&gt;  &lt;p&gt;&lt;a href=&quot;http://users.telenet.be/patrickdeboeck/blog/accounting/Version1.png&quot; target=&quot;_blank&quot;&gt;&lt;img style=&quot;border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px&quot; height=&quot;174&quot; alt=&quot;Version1&quot; src=&quot;http://lh6.ggpht.com/Gilsboys11/SEHD56FpNyI/AAAAAAAAACc/kzLIBvChyzw/Version14.png?imgmax=800&quot; width=&quot;244&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&amp;#160; &lt;br /&gt;I deliberately kept everything as simple as possible so I can make future improvements to demonstrate what this means in terms of database upgrades, refactorings possibilities, etc....&amp;#160; If you want to follow everything that is explained here below, you can download the complete solution &lt;a href=&quot;https://www.allors.com/svn/applications/trunk/dotnet/Samples/AccountingSampleSolution.zip&quot; target=&quot;_blank&quot;&gt;here&lt;/a&gt; or built everything yourself of course.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Building the domain (Allors)&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;To start building an Allors domain you first need to download the binaries and the Allors Repository.&amp;#160; You can either checkout the sources from the subversion (&lt;a href=&quot;https://www.allors.com/svn/platform&quot;&gt;https://www.allors.com/svn/platform&lt;/a&gt;) or you can download the &lt;a href=&quot;https://www.allors.com/svn/applications/trunk/dotnet/QuickStart/Allors QuickStart.zip&quot; target=&quot;_blank&quot;&gt;Quick Start file&lt;/a&gt; I&#39;ve put together. The zip contains two directories &amp;amp; a command file&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;u&gt;lib&lt;/u&gt;: Directory containing the Allors binaries and the Allors Repository, you should extract these in your solution folder. &lt;/li&gt;    &lt;li&gt;&lt;u&gt;Allors&lt;/u&gt;: Directory for the Allors Domain Files, you should extract these in your domain project folder. &lt;/li&gt;    &lt;li&gt;&lt;u&gt;AllorsRepository.cmd&lt;/u&gt;: file that will startup the AllorsRepository Tool for you domain, this should be extracted in your solution folder. &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;u&gt;Step 1: Setting up the solution hierarchy&lt;/u&gt;&lt;/p&gt;  &lt;p&gt;The solution structure I have applied consists of 4 projects.&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Diagrams: containing the diagrams of my domain.&amp;#160; This project will contain only generated code with getters/setter that reflect your domain.&amp;#160; You can then use these to generate your class diagrams. &lt;/li&gt;    &lt;li&gt;Domain: the heart and soul of our accounting application, you should refer to the Allors.Framework.dll here. &lt;/li&gt;    &lt;li&gt;Population: Helper classes to build your domain objects and setup an initial population for unit/integration testing. &lt;/li&gt;    &lt;li&gt;Unittests: proving our design and domain is correct and well thought. &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;a href=&quot;http://lh4.ggpht.com/Gilsboys11/SEHD7GO-tpI/AAAAAAAAACk/MlxD-yCYyzU/s1600-h/image2.png&quot;&gt;&lt;img style=&quot;border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px&quot; height=&quot;169&quot; alt=&quot;image&quot; src=&quot;http://lh5.ggpht.com/Gilsboys11/SEHD8NYv5yI/AAAAAAAAACs/vKaXiZtf8Sg/image_thumb.png?imgmax=800&quot; width=&quot;244&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;u&gt;Step 2: Creating the Allorized domain&lt;/u&gt;&lt;/p&gt;  &lt;p&gt;The Allors folder from the zip file needs to be copied into your domain folder.&amp;#160; This folder will contain the meta information (allors.repository) about your domain classes, which is built up using the AllorsRepository-Application (included in the zip file).&amp;#160; if you modify the command file that was included in the zip file so that the parameter passed in to start up the &amp;quot;Allors.Repository.Application.exe&amp;quot; refers to the allors.repository in your domain folder, this file will now fire up the AllorsRepository-Application for your domain.&amp;#160; You should see the following (if you are building from scratch, otherwise your domain will be completely filled in).&lt;/p&gt;  &lt;p&gt;&lt;a href=&quot;http://lh6.ggpht.com/Gilsboys11/SEHD9VvPAHI/AAAAAAAAAC0/nPRB5skoWyc/s1600-h/image3.png&quot;&gt;&lt;img style=&quot;border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px&quot; height=&quot;159&quot; alt=&quot;image&quot; src=&quot;http://lh3.ggpht.com/Gilsboys11/SEHD-LmFp7I/AAAAAAAAAC8/xtflAEyOIjM/image_thumb1.png?imgmax=800&quot; width=&quot;244&quot; border=&quot;0&quot; /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;This screen has three main parts.&amp;#160; &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;The top left has a tree containing all your types and relations in your domain &lt;/li&gt;    &lt;li&gt;The top right is the property window of the selected treeNode &lt;/li&gt;    &lt;li&gt;The bottom gives information about errors in your domain &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;All actions are available by rightclicking the treeNode and then select the action in the context menu or change the node&#39;s corresponding properties.&amp;#160; If you need to know how things are getting done, you can checkout the &lt;a href=&quot;https://www.allors.com/trac/platform/wiki/GettingStarted&quot; target=&quot;_blank&quot;&gt;getting started page&lt;/a&gt; of the &lt;a href=&quot;https://www.allors.com/&quot; target=&quot;_blank&quot;&gt;Allors website&lt;/a&gt;.&amp;#160; On the bottom you can see that the repository already has one error.&amp;#160; It has no name, so you need to select the domain node and fill in the name in the properties window.&lt;/p&gt;  &lt;p&gt;&lt;u&gt;Step 3: Namespaces &amp;amp; Types&lt;/u&gt;&lt;/p&gt;  &lt;p&gt;Our solution will have two namespaces to start with.&amp;#160; You can see &lt;a href=&quot;https://www.allors.com/trac/platform/wiki/CreatingNamespaces&quot; target=&quot;_blank&quot;&gt;here&lt;/a&gt; how you can add namespaces in the repository.&amp;#160; The types we are building are shown in the diagram above, you can easily add them yourself in the allors repository.&amp;#160; It is written out &lt;a href=&quot;https://www.allors.com/trac/platform/wiki/CreatingTypes&quot; target=&quot;_blank&quot;&gt;here&lt;/a&gt; how you can achieve that.&amp;#160; All objects belong to the Accounting namespace, only the DatePeriod type is more generic and is placed into its own General namespaces &lt;/p&gt;  &lt;p&gt;&lt;u&gt;Step 4: Attributes &amp;amp; Relations &lt;/u&gt;&lt;/p&gt;  &lt;p&gt;We now have domain containing single classes without any attributes or relationships between them.&amp;#160; You cannot call this a domain of course so the logical next step to give our objects data and connect them through the use of relations.&amp;#160; As always you can checkout &lt;a href=&quot;https://www.allors.com/trac/platform/wiki/CreatingRelations&quot; target=&quot;_blank&quot;&gt;here&lt;/a&gt; how everything can be done.&amp;#160; The above diagram gives you all the information you need to create all the relations.&lt;/p&gt;  &lt;p&gt;&lt;u&gt;Step 5: Adding Domain Logic&lt;/u&gt;&lt;/p&gt;  &lt;p&gt;The Allors domain has been built (you can download the zip file here).&amp;#160; The next step is to generate (right click the domain and select generate) our allors classes, these will be our base classes for our domain objects.&amp;#160; You don&#39;t have to remember to inherit any classes or interfaces because we generate a partial class for you as well.&amp;#160; Include these files (located inside the Allors/output/folder by default, but this can be tweaked of course) in your domain project and you can start using them.&amp;#160; Every object you instantiate now is inside a Session, the creation is performed through the Session as you can see in the next code block:&lt;/p&gt;  &lt;div class=&quot;wlWriterSmartContent&quot; id=&quot;scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:0d8a72d4-453c-4471-aa7c-95e032c1a849&quot; style=&quot;padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px&quot;&gt;&lt;pre style=&quot;background-color:White;;overflow: auto;&quot;&gt;&lt;div&gt;&lt;!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

--&gt;&lt;span style=&quot;color: #008080; &quot;&gt; 1&lt;/span&gt; &lt;span style=&quot;color: #0000FF; &quot;&gt;public&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;static&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; Account Create(AllorsSession session, 
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt; 2&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;                              &lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;string&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; bank, 
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt; 3&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;                              &lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;string&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; number)
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt; 4&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;{
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt; 5&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;      Check.Argument(number, &lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;number&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;).IsNotNullAndNotEmptyAndNotWhiteSpace();
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt; 6&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;      Check.Argument(bank, &lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;bank&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;).IsNotNullAndNotEmptyAndNotWhiteSpace();
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt; 7&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt; 8&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;      var account &lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; session.Create&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;Account&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;();
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt; 9&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;      account.Bank &lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; bank;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;10&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;      account.Number &lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; number;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;11&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;12&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;      &lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;return&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; account;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;13&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;!-- Code inserted with Steve Dunn&#39;s Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --&gt;&lt;/div&gt;

&lt;p&gt;Adding the actual business logic is done simply by adding the methods into your class (as you normally would)&lt;/p&gt;

&lt;div class=&quot;wlWriterSmartContent&quot; id=&quot;scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:988bf810-c273-49f8-8eae-c76b149e70d5&quot; style=&quot;padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px&quot;&gt;&lt;pre style=&quot;background-color:White;;overflow: auto;&quot;&gt;&lt;div&gt;&lt;!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

--&gt;&lt;span style=&quot;color: #008080; &quot;&gt; 1&lt;/span&gt; &lt;span style=&quot;color: #0000FF; &quot;&gt;public&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; TimeRegistration RegisterWorkingTime(DateTime date, Double hours)
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt; 2&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;{            
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt; 3&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;      &lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;return&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; TimeRegistration.Create(AllorsSession, date, &lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;this&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;, hours);
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt; 4&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;}
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt; 5&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt; 6&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;public&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; Invoice BuildInvoice(DatePeriod period, 
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt; 7&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;                                    String reference, 
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt; 8&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;                                    DateTime invoiceDate,
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt; 9&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;                                    IInvoiceCalculator invoiceCalculator)
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;10&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;{
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;11&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;      VerifyThatInvoiceReferenceIsUnique(reference);
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;12&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;13&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;      var timeRegistrations &lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;new&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; TimeRegistrationFinder(AllorsSession)
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;14&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;                                                                .GetNotInvoicedTimeRegistrationsFor(&lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;this&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;,period);
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;15&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;       &lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; (timeRegistrations.Length &lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;==&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;)
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;16&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;       {
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;17&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;           &lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;throw&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;new&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; ArgumentException(&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;Invoice must contain TimeRegistrations&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;);
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;18&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;       }
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;19&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;20&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;       var invoice &lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; Invoice.Create(AllorsSession, reference, invoiceDate);
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;21&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;       AddInvoice(invoice);
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;22&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;23&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;      &lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;foreach&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; (var timeRegistration &lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;in&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; timeRegistrations)
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;24&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;      {
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;25&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;           invoice.InvoiceTimeRegistration(timeRegistration, invoiceCalculator);
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;26&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;      }
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;27&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;28&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;      &lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;return&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; invoice;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;29&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;!-- Code inserted with Steve Dunn&#39;s Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --&gt;&lt;/div&gt;&lt;/pre&gt;&lt;!-- Code inserted with Steve Dunn&#39;s Windows Live Writer Code Formatter Plugin.  http://dunnhq.com &lt;/div&gt;--&gt;

&lt;p&gt;&lt;u&gt;Step 6: Unit Testing&lt;/u&gt;&lt;/p&gt;

&lt;p&gt;Since all objects are Session aware we need to have a Session in our UnitTests.&amp;#160; For performance reasons we will not use a real database, but rather work completely in memory.&amp;#160; The following code creates an in-memory session for our domain.&amp;#160; &lt;/p&gt;

&lt;p&gt;
  &lt;div class=&quot;wlWriterSmartContent&quot; id=&quot;scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:a75c12c0-29f3-4bb6-9feb-2366395d9aad&quot; style=&quot;padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px&quot;&gt;&lt;pre style=&quot;background-color:White;;overflow: auto;&quot;&gt;&lt;div&gt;&lt;!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

--&gt;&lt;span style=&quot;color: #000000; &quot;&gt;var population &lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;new&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; Allors.Adapters.Memory.AllorsConnectedMemoryPopulation(&lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;new&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; AccountingDomainConfiguration());
population.Init();
_session &lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; population.CreateSession();
&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;!-- Code inserted with Steve Dunn&#39;s Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --&gt;&lt;/div&gt;
&lt;/p&gt;

&lt;p&gt;You can then create your objects with this sessions and perform the regular tests you would normally write.&lt;/p&gt;

&lt;div class=&quot;wlWriterSmartContent&quot; id=&quot;scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:404829c2-62a1-491b-bb21-600f51bb1fd8&quot; style=&quot;padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px&quot;&gt;&lt;pre style=&quot;background-color:White;;overflow: auto;&quot;&gt;&lt;div&gt;&lt;!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

--&gt;&lt;span style=&quot;color: #008080; &quot;&gt; 1&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;[TestFixture]
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt; 2&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;public&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;class&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; When_creating_an_account : AllorsBaseTest
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt; 3&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;{
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt; 4&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;private&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; AccountBuilder _builder;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt; 5&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt; 6&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;    [Test]
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt; 7&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;    [ExpectedException(&lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;typeof&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;(ArgumentNullException))]
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt; 8&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;public&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;void&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; Then_expect_an_error_when_the_number_is_null()
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt; 9&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;    {
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;10&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;        _builder &lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;new&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; AccountBuilder(Session);
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;11&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;        _builder.WithBank(&lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;null&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;).Build();
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;12&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;    }
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;13&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;!-- Code inserted with Steve Dunn&#39;s Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --&gt;&lt;/div&gt;

&lt;p&gt;&lt;u&gt;The final step is to make our domain persistent.&lt;/u&gt;&lt;/p&gt;

&lt;p&gt;For this I created a new project (IntegrationTests).&amp;#160; You do not need to supply mapping files because Allors will make and initialize the database scheme for you based on the meta information you supplied.&amp;#160; This is achieved by simply instantiating the correct population and Session, here we will use the SQL Server Express Edition.&amp;#160; For unittesting we created the population in code (and for memory), you could as well set everything in the config file:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;First of all you need to declare the allors section in the config &lt;/li&gt;
  &lt;li&gt;You need to configure your populations(or multiple of them) + connectionstrings &lt;/li&gt;
  &lt;li&gt;Finally you need to create the population from based on the name in the config &lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;wlWriterSmartContent&quot; id=&quot;scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:965f34bf-b1a0-400c-b332-cbb5e2f9918e&quot; style=&quot;padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px&quot;&gt;&lt;pre style=&quot;background-color:White;;overflow: auto;&quot;&gt;&lt;div&gt;&lt;!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

--&gt;&lt;span style=&quot;color: #008080; &quot;&gt; 1&lt;/span&gt; &lt;span style=&quot;color: #0000FF; &quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000; &quot;&gt;configSections&lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt; 2&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000; &quot;&gt;section &lt;/span&gt;&lt;span style=&quot;color: #FF0000; &quot;&gt;name&lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;=&amp;quot;allors&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #FF0000; &quot;&gt; type&lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;=&amp;quot;Allors.AllorsConfigurationSection, Allors.Framework&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt; 3&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #800000; &quot;&gt;configSections&lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt; 4&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt; 5&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000; &quot;&gt;allors&lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt; 6&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000; &quot;&gt;populations&lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt; 7&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;      &lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000; &quot;&gt;add &lt;/span&gt;&lt;span style=&quot;color: #FF0000; &quot;&gt;name&lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;=&amp;quot;AccountingPopulation&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #FF0000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt; 8&lt;/span&gt; &lt;span style=&quot;color: #FF0000; &quot;&gt;           type&lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;=&amp;quot;Allors.Adapters.SqlClient.AllorsSqlClientPopulation, Allors.Adapters.SqlClient&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #FF0000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt; 9&lt;/span&gt; &lt;span style=&quot;color: #FF0000; &quot;&gt;           domainConfiguration&lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;=&amp;quot;AllorsDomains.AccountingDomainConfiguration, Pdbc.Accounting.Domain&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #FF0000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;10&lt;/span&gt; &lt;span style=&quot;color: #FF0000; &quot;&gt;           connectionStringName&lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;=&amp;quot;accounting&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;11&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;      &lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #800000; &quot;&gt;add&lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;      
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;12&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #800000; &quot;&gt;populations&lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;13&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #800000; &quot;&gt;allors&lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;14&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;  
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;15&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000; &quot;&gt;connectionStrings&lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;16&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000; &quot;&gt;add &lt;/span&gt;&lt;span style=&quot;color: #FF0000; &quot;&gt;name&lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;=&amp;quot;accounting&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #FF0000; &quot;&gt; connectionString&lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;=&amp;quot;Data Source=Pdbc-Laptop\SqlExpress;Initial Catalog=accounting;Integrated Security=True&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;17&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #800000; &quot;&gt;connectionStrings&lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;!-- Code inserted with Steve Dunn&#39;s Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --&gt;&lt;/div&gt;

&lt;p&gt;
  Then in code we can retrieve the population and instantiate the session.&amp;#160; The Init method by the way drops the database and recreates it which makes sure that our integration tests always have the latest version of the database scheme available. &lt;/p&gt;

&lt;div class=&quot;wlWriterSmartContent&quot; id=&quot;scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:c441b0f3-5794-4821-9e0a-d5004b34a993&quot; style=&quot;padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px&quot;&gt;&lt;pre style=&quot;background-color:White;;overflow: auto;&quot;&gt;&lt;div&gt;&lt;!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

--&gt;&lt;span style=&quot;color: #008080; &quot;&gt;1&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;var population &lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; AllorsConfiguration.GetPopulation(&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;AccountingPopulation&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;); 
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;2&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;population.Init();
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;3&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;_session &lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; population.CreateSession();&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;!-- Code inserted with Steve Dunn&#39;s Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --&gt;&lt;/div&gt;

&lt;p&gt;
Check the &lt;a href=&quot;https://www.allors.com/svn/applications/trunk/dotnet/Samples/AccountingSampleSolution.zip&quot; target=&quot;_blank&quot;&gt;complete sample&lt;/a&gt; along with the unittests for a complete overview.&amp;#160; As you notice, the major difference with traditional POCO domain objects is that we need to inherit from an Allors Class.&amp;#160; This Class encapsulates the access to a strategy object which contains all your class attributes and object relations.&amp;#160; This way we can keep all objects managed by Allors which has a lot of benefits (lazy loading, managed relations, ...) , but that is for a next post.&amp;#160; &lt;/p&gt;

&lt;p&gt;Let me know what you think about it and have a spin with the sample.&amp;#160;&amp;#160; &lt;/p&gt;  </description><link>http://patrickdeboeck.blogspot.com/2008/05/ddad-domain-driven-design.html</link><author>noreply@blogger.com (Patrick)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh6.ggpht.com/Gilsboys11/SEHD56FpNyI/AAAAAAAAACc/kzLIBvChyzw/s72-c/Version14.png?imgmax=800" height="72" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8902397729199783860.post-1929372756167872536</guid><pubDate>Tue, 27 May 2008 21:24:00 +0000</pubDate><atom:updated>2008-05-27T23:24:33.634+02:00</atom:updated><title>Filtering your Nhibernate SQL Log: The good way</title><description>&lt;p&gt;Apparently my &lt;a href=&quot;http://patrickdeboeck.blogspot.com/2008/05/know-what-happens-on-your-database.html&quot; target=&quot;_blank&quot;&gt;previous post&lt;/a&gt; about filtering out the unique sql statements NHibernate fires at your database is a quick and dirty hack.&amp;#160; Sure it works but why create a complete new appender&amp;#160; if all you want to do is decorate the existing ones with filtering.&amp;#160; If I would have read the &lt;a href=&quot;http://logging.apache.org/log4net/release/manual/introduction.html&quot; target=&quot;_blank&quot;&gt;documentation&lt;/a&gt; that the good people of &lt;a href=&quot;http://logging.apache.org/log4net/&quot; target=&quot;_blank&quot;&gt;log4net&lt;/a&gt; have prepared for the world, I would have noticed the concept of Filters.&amp;#160; These form a chain that the logging event has to pass through in order to actually get logged.&lt;/p&gt;  &lt;p&gt;Here is the same code that should do the trick using the filters, remember to add this filter in your appender declaration in the configuration file&lt;/p&gt;  &lt;p&gt;   &lt;div class=&quot;wlWriterSmartContent&quot; id=&quot;scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:095f6a01-73b6-4a3e-9f3e-116abb526759&quot; style=&quot;padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px&quot;&gt;&lt;pre style=&quot;background-color:White;;overflow: auto;&quot;&gt;&lt;div&gt;&lt;!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

--&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;public&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;class&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; NHibernateUniqueQueryFilter : FilterSkeleton
{
    &lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;private&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;static&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;readonly&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; List&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;String&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; statements &lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;new&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; List&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;string&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;();

    &lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;public&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;override&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; FilterDecision Decide(LoggingEvent loggingEvent)
    {
         var message &lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; loggingEvent.RenderedMessage;
         var index &lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; loggingEvent.RenderedMessage.IndexOf(&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;);
         &lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; (index &lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;!=&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;)
         {
             message &lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; loggingEvent.RenderedMessage.Substring(&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;, index);
         }

         &lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; (statements.Contains(message))
         {
             &lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;return&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; FilterDecision.Deny;
         }

         statements.Add(message);
            
          &lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;return&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; FilterDecision.Accept;
    }
}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;!-- Code inserted with Steve Dunn&#39;s Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --&gt;&lt;/div&gt;&lt;/p&gt;  </description><link>http://patrickdeboeck.blogspot.com/2008/05/filtering-your-nhibernate-sql-log-good.html</link><author>noreply@blogger.com (Patrick)</author><thr:total>1</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8902397729199783860.post-4922816632470045728</guid><pubDate>Tue, 27 May 2008 21:01:00 +0000</pubDate><atom:updated>2008-05-27T23:01:34.915+02:00</atom:updated><title>It&amp;#39;s Peter Time</title><description>&lt;p&gt;Today (actually yesterday) &lt;a href=&quot;http://www.peter.worksontheweb.net/&quot; target=&quot;_blank&quot;&gt;Peter Eysermans&lt;/a&gt; started his blog.&amp;#160; Peter is one of my colleagues and a really funny guy, he is an authority (or will be :-)) on Web Development.&amp;#160; So if you want to follow his quest for world web domination then check out his &lt;a href=&quot;http://www.peter.worksontheweb.net/&quot; target=&quot;_blank&quot;&gt;blog&lt;/a&gt; or &lt;a href=&quot;http://feeds.feedburner.com/PeterWorksOnTheWeb&quot; target=&quot;_blank&quot;&gt;subscribe to it&lt;/a&gt;).&amp;#160; I for one am looking forward to his next post : The pussy way of development&#39;! &lt;/p&gt;  </description><link>http://patrickdeboeck.blogspot.com/2008/05/it-peter-time.html</link><author>noreply@blogger.com (Patrick)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8902397729199783860.post-3048366252192112772</guid><pubDate>Fri, 23 May 2008 12:45:00 +0000</pubDate><atom:updated>2008-05-23T14:45:14.123+02:00</atom:updated><title>Resharper 4.0 Stable release</title><description>&lt;p&gt;I am using Resharper since version 2.0 and VS2003.&amp;#160; In those days there were major problems with the memory consumption of the tool, resulting in a slow IDE and multiple crashes.&amp;#160; Just when I was going to remove it from my system, I made the shift to VS2005 and Resharper 2.5 (and 3.0).&amp;#160; It couldn&#39;t have come at a better time because I never doubted the guys from Jetbrains ever again.&lt;/p&gt;  &lt;p&gt;A while ago I installed one of the 4.0 EAP Releases (4.0.775.22).&amp;#160; Some of my solutions not even the big ones took ages to start up and occasionally my studio froze!&amp;#160; I quickly reverted to my old version no harm done.&amp;#160; But a couple of days ago a Stable version was released and I decided to give it another try.&amp;#160; My problem solution now still take a little longer to load, but I didn&#39;t suffer any freezes anymore.&amp;#160; The support for the .NET 3.5 framework makes the loading time a necessary evil, besides you need this version if you really want to develop in VS2008 (and not be annoyed by non-compilation warnings from Resharper about the new language stuff)&lt;/p&gt;  &lt;p&gt;You can buy a license for the currently released 3.5 and are allowed to upgrade to 4.0 once this version becomes available.&amp;#160; So what is stopping ya?&lt;/p&gt;  &lt;p&gt;By the way, thanks to &lt;a href=&quot;http://www.blogger.com/profile/14966746474791511643&quot;&gt;Ilya Ryzhenkov&lt;/a&gt; for providing a list of nice &lt;a href=&quot;http://resharper.blogspot.com/2008/04/extending-extension-resharper-plug-ins.html&quot;&gt;plug-ins for Resharper&lt;/a&gt;, these have proven to be quite helpful&lt;strong&gt;. &lt;/strong&gt;&lt;/p&gt;  </description><link>http://patrickdeboeck.blogspot.com/2008/05/resharper-40-stable-release.html</link><author>noreply@blogger.com (Patrick)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8902397729199783860.post-5565564332385998065</guid><pubDate>Wed, 21 May 2008 20:51:00 +0000</pubDate><atom:updated>2008-05-21T22:51:06.943+02:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Log4Net</category><category domain="http://www.blogger.com/atom/ns#">NHibernate</category><title>Know what happens on your database</title><description>&lt;p&gt;Although I believe that an ORM should take care of the persistence, you as a developer NEED to know what happens on your database.&amp;#160; You need to know what SQL - statements get fired.&amp;#160; NHibernate uses &lt;a href=&quot;http://logging.apache.org/log4net/index.html&quot; target=&quot;_blank&quot;&gt;Log4Net&lt;/a&gt; for this, with a simple configuration setting you make NHibernate log all statements that make the trip to the database.&amp;#160; In the hibernate-configuration you can set the &amp;quot;show_sql&amp;quot; property to true.&amp;#160; You then need to specify the Nhibernate logger (be sure to name this &amp;quot;NHibernate.SQL&amp;quot; and link it to an appender.&amp;#160; The following config section simply does that:&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;div class=&quot;wlWriterSmartContent&quot; id=&quot;scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:6b4fdce8-d0a4-4907-a2a2-2d86d757360c&quot; style=&quot;padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px&quot;&gt;&lt;pre style=&quot;background-color:White;white-space:-moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; white-space: pre-wrap; word-wrap: break-word;;overflow: auto;&quot;&gt;&lt;div&gt;&lt;!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

--&gt;&lt;span style=&quot;color: #008080; &quot;&gt; 1&lt;/span&gt; &lt;span style=&quot;color: #0000FF; &quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000; &quot;&gt;log4net&lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt; 2&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000; &quot;&gt;appender &lt;/span&gt;&lt;span style=&quot;color: #FF0000; &quot;&gt;name&lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;=&amp;quot;NHibernateSQLLog&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #FF0000; &quot;&gt; type&lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;=&amp;quot;log4net.Appender.RollingFileAppender&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt; 3&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;        &lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000; &quot;&gt;file &lt;/span&gt;&lt;span style=&quot;color: #FF0000; &quot;&gt;value&lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;=&amp;quot;nhibernate_sql_statements.txt&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt; 4&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;        &lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000; &quot;&gt;appendToFile &lt;/span&gt;&lt;span style=&quot;color: #FF0000; &quot;&gt;value&lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;=&amp;quot;true&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt; 5&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;        &lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000; &quot;&gt;rollingStyle &lt;/span&gt;&lt;span style=&quot;color: #FF0000; &quot;&gt;value&lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;=&amp;quot;Size&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt; 6&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;        &lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000; &quot;&gt;maxSizeRollBackups &lt;/span&gt;&lt;span style=&quot;color: #FF0000; &quot;&gt;value&lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;=&amp;quot;10&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt; 7&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;        &lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000; &quot;&gt;maximumFileSize &lt;/span&gt;&lt;span style=&quot;color: #FF0000; &quot;&gt;value&lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;=&amp;quot;1000KB&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt; 8&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;        &lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000; &quot;&gt;staticLogFileName &lt;/span&gt;&lt;span style=&quot;color: #FF0000; &quot;&gt;value&lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;=&amp;quot;true&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt; 9&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;        &lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000; &quot;&gt;layout &lt;/span&gt;&lt;span style=&quot;color: #FF0000; &quot;&gt;type&lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;=&amp;quot;log4net.Layout.PatternLayout&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;10&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;            &lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000; &quot;&gt;conversionPattern &lt;/span&gt;&lt;span style=&quot;color: #FF0000; &quot;&gt;value&lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;=&amp;quot;%d{HH:mm:ss.fff} [%t] %-5p %c - %m%n&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;11&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;        &lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #800000; &quot;&gt;layout&lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;12&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #800000; &quot;&gt;appender&lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;13&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000; &quot;&gt;logger &lt;/span&gt;&lt;span style=&quot;color: #FF0000; &quot;&gt;name&lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;=&amp;quot;NHibernate.SQL&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #FF0000; &quot;&gt; additivity&lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;=&amp;quot;false&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;14&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;        &lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000; &quot;&gt;level &lt;/span&gt;&lt;span style=&quot;color: #FF0000; &quot;&gt;value&lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;=&amp;quot;DEBUG&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;15&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;        &lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000; &quot;&gt;appender-ref &lt;/span&gt;&lt;span style=&quot;color: #FF0000; &quot;&gt;ref&lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;=&amp;quot;NHibernateSQLLog&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;16&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #800000; &quot;&gt;logger&lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;17&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #800000; &quot;&gt;log4net&lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;!-- Code inserted with Steve Dunn&#39;s Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --&gt;&lt;/div&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;As already mentioned in a &lt;a href=&quot;http://patrickdeboeck.blogspot.com/2008/04/nhibernate-here-we-come.html&quot; target=&quot;_blank&quot;&gt;previous post&lt;/a&gt; we had to be very persuasive in order to use NHibernate.&amp;#160; One of the questions our DBA guys had was &amp;quot;what was going on on their database, can we see what queries and statements get executed?&amp;quot;.&amp;#160; The above gives us all information, however it is not very useful for them as they have to go through tons of duplicate statements.&amp;#160; Fortunately Log4Net is very extensible, you can easily build your &lt;a href=&quot;http://logging.apache.org/log4net/release/sdk/log4net.Appender.html&quot; target=&quot;_blank&quot;&gt;Appender&lt;/a&gt; and filter out the information you do not want to log.&amp;#160; The easiest solution is to extend the appender you would normally use, (for example the RollingFileAppender) and override FilterEvent method.&amp;#160; You can then return false for every loggingEvent that you do not want written out.&amp;#160; &lt;/p&gt;

&lt;div class=&quot;wlWriterSmartContent&quot; id=&quot;scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:9c00b309-d20c-4254-aa65-afbe04277805&quot; style=&quot;padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px&quot;&gt;&lt;pre style=&quot;background-color:White;white-space:-moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; white-space: pre-wrap; word-wrap: break-word;;overflow: auto;&quot;&gt;&lt;div&gt;&lt;!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

--&gt;&lt;span style=&quot;color: #008080; &quot;&gt; 1&lt;/span&gt; &lt;span style=&quot;color: #0000FF; &quot;&gt;private&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;static&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; List&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;String&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; statements &lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;new&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; List&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;string&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;();
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt; 2&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt; 3&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt; 4&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;protected&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;override&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;bool&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; FilterEvent(log4net.Core.LoggingEvent loggingEvent)
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt; 5&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;{
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt; 6&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;string&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; message &lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; loggingEvent.RenderedMessage;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt; 7&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;int&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; index &lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; loggingEvent.RenderedMessage.IndexOf(&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;);
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt; 8&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; (index &lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;!=&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;) 
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt; 9&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;    {
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;10&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;         message &lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; loggingEvent.RenderedMessage.Substring(&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;, index);
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;11&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;    }
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;12&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;            
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;13&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; (statements.Contains(message))
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;14&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;    {
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;15&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;         &lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;return&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;false&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;16&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;    }
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;17&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;18&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;    statements.Add(message);
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;19&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;20&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;return&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;base&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;.FilterEvent(loggingEvent);
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;21&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;!-- Code inserted with Steve Dunn&#39;s Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --&gt;&lt;/div&gt;

&lt;p&gt;In this example I build a list of all statements that have already been logged.&amp;#160; First we need to filter out the parameters, because otherwise no statement would be unique.&amp;#160; The loggingEvent contains a RenderedMessage that consist of two parts.&amp;#160; First the actual statement containing wildcards or named parameters.&amp;#160; Then the character &#39;;&#39; and lastly the mapping of the parameters.&amp;#160; We only need the part before the &#39;;&#39; because any statement can be called multiple times with different parameters.&amp;#160; Once we have the actual query statement we try to find this in our list and return false if it has already been logged.&amp;#160; The result is that our logfile now only contain unique statements.&amp;#160; The parameters included are those from the first time this statement was logged (Since the RenderedMessage is read-only we cannot remove these).&lt;/p&gt;  </description><link>http://patrickdeboeck.blogspot.com/2008/05/know-what-happens-on-your-database.html</link><author>noreply@blogger.com (Patrick)</author><thr:total>1</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8902397729199783860.post-1230171669718789835</guid><pubDate>Tue, 20 May 2008 20:19:00 +0000</pubDate><atom:updated>2008-05-20T22:24:10.670+02:00</atom:updated><title>NHibernate&amp;#39;s Optimistic Locking: Where did we go wrong?</title><description>&lt;p&gt;I was trying to get optimistic locking to work properly by applying the following articles (&lt;a href=&quot;http://www.lostechies.com/blogs/rhouston/archive/2008/03/23/mapping-timestamp-data-using-nhibernate-s-icompositeusertype.aspx&quot; target=&quot;_blank&quot;&gt;this&lt;/a&gt; and &lt;a href=&quot;http://www.lostechies.com/blogs/rhouston/archive/2008/03/23/mapping-timestamp-data-using-nhibernate-s-icompositeusertype.aspx&quot; target=&quot;_blank&quot;&gt;this&lt;/a&gt;) from &lt;a href=&quot;http://www.lostechies.com/blogs/rhouston/default.aspx&quot; target=&quot;_blank&quot;&gt;Ray Houston&lt;/a&gt;.&amp;#160; I got it up and running in a couple of minutes and my audit information was automatically saved whenever I inserted or updated an object.&amp;#160; If you think you can let NHibernate handle the version in this case you are wrong.&amp;#160; The version (or timestamp) attribute needs to map to a single database column if you want to use it for optimistic locking.&lt;/p&gt;  &lt;p&gt;So in order to have a working locking strategy I removed the LastModified Timestamp from my CompositeUserType and added a specific timestamp property in my mapping file.&amp;#160;&amp;#160; &lt;/p&gt;  &lt;p&gt;Piece of cake, .... however&amp;#160; ..... what happens when you start working disconnected?&amp;#160; You have two possible solutions.&amp;#160; Keeping your Session open (which will kill your application&#39;s scalability) or you can re-attach the objects into a new session (prefer this solution if you can).&amp;#160; &lt;/p&gt;  &lt;p&gt;Now consider my business use case where I am loading an entire object graph in my server session, these objects are transformed to DTO&#39;s and send to the client.&amp;#160; The client then makes some changes and sends me only the updated values.&amp;#160; In other words I cannot attach my objects into a new session because I simply do not have all the information at my disposal.&amp;#160; There is simple solution for this problem, &lt;a href=&quot;http://www.hibernate.org/hib_docs/nhibernate/1.2/reference/en/html_single/#transactions-optimistic&quot; target=&quot;_blank&quot;&gt;do it yourself&lt;/a&gt; (&lt;a href=&quot;http://www.hibernate.org/hib_docs/nhibernate/1.2/reference/en/html_single/#transactions-optimistic&quot; target=&quot;_blank&quot;&gt;check 10.4.4 application version&lt;/a&gt; checking of the Nhibernate online documentation).&amp;#160; &lt;/p&gt;  &lt;p&gt;I decided to load the entire object graph again and set the LastModified whenever I apply the changes from the client.&amp;#160; My version check will happen in the interceptor in the OnFlushDirty method, there I will check the original value of the date with the version I got back from the client (and applied in the object).&lt;/p&gt;  &lt;div class=&quot;wlWriterSmartContent&quot; id=&quot;scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:0215dac5-c6e0-48c2-8a70-f988a6acc267&quot; style=&quot;padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px&quot;&gt;&lt;pre style=&quot;background-color:White;;overflow: auto;&quot;&gt;&lt;div&gt;&lt;!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

--&gt;&lt;span style=&quot;color: #000000; &quot;&gt;Int32 lastModificationPropertyIndex &lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; Array.IndexOf(propertyNames, lastModificationProperty);            
&lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; (&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;!=&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; lastModificationPropertyIndex)
{
       DateTime originalDateTime &lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; (DateTime)(previousState[lastModificationPropertyIndex]);
       DateTime currentDateTime &lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; domainObject.LastModification;

       &lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; (originalDateTime.Ticks &lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;!=&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; currentDateTime.Ticks)
       {
            &lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;(originalDateTime &lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;!=&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; DateTime.MinValue)
            {
                 &lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;throw&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;new&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; StaleObjectException(id);
            }
       }
}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;!-- Code inserted with Steve Dunn&#39;s Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --&gt;&lt;/div&gt;

&lt;p&gt;The OnFlushDirty method is called only for dirty objects, the OnSave is called for new objects (although I added the check that the originalDateTime must be different than the MinValue if it should happen that this method gets called for new objects).&amp;#160; 75% of the time this seems to work but sometimes the StaleObjectException is thrown when and object is not out-of-date.&amp;#160; The LastModified date is updated whenever the data is flushed to the database.&amp;#160; This flushing can be set on the session using the enumeration type FlushMode. Default is set to Automatic meaning that it can happen that the session is flushed before a query.&amp;#160; The session now gets flushed before the interceptor gets called (strange, but this seems to be the reason).&amp;#160; Setting the FlushMode to Commit or Never seems to resolve the above issue because then the flush has to be called manually or by committing a transaction.&lt;/p&gt;

&lt;p&gt;Till next time&lt;/p&gt;  </description><link>http://patrickdeboeck.blogspot.com/2008/05/nhibernate-optimistic-locking-where-did.html</link><author>noreply@blogger.com (Patrick)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8902397729199783860.post-9117090130838822714</guid><pubDate>Sat, 10 May 2008 10:40:00 +0000</pubDate><atom:updated>2008-05-10T12:55:48.591+02:00</atom:updated><title>Allors vs NHibernate</title><description>&lt;p&gt;Since we are now able to use &lt;a href=&quot;http://www.hibernate.org/362.html&quot; target=&quot;_blank&quot;&gt;NHibernate&lt;/a&gt; at my current job, I decided I needed to alter my blogging strategy a little bit.&amp;#160; It was my intention to demonstrate &lt;a href=&quot;http://www.allors.com&quot; target=&quot;_blank&quot;&gt;Allors&lt;/a&gt; in a couple of posts during which I would build up an invoicing application.&amp;#160; Since I will have to do some learning of Nhibernate (reading the book &lt;a href=&quot;http://www.manning.com/kuate/&quot; target=&quot;_blank&quot;&gt;&#39;Nhibernate in Action&#39;&lt;/a&gt;), I decided to build the same application in NHibernate as home practice.&amp;#160; This way I can see what the strong and weak points of both the frameworks are create a good comparison between them.&lt;/p&gt;  &lt;p&gt;Let&#39;s go high level and write down the differences I can spot immediately without an in depth knowledge of &lt;a href=&quot;http://www.hibernate.org/362.html&quot; target=&quot;_blank&quot;&gt;NHibernate&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;What is Allors&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;Allors is not a pure mapper tool, it is a &#39;Domain Driven Enabler&#39;.&amp;#160; Your domain will be modeled (by using a &amp;quot;repository explorer&amp;quot;) into a meta domain.&amp;#160; This results in having full control of all your complete domain information both at runtime and design time.&amp;#160; This meta information will be used to generate a database scheme for you (if you decide to deploy to a database, you can work completely in memory as well).&amp;#160; &lt;/p&gt;  &lt;p&gt;All access to class variables goes through strategy objects.&amp;#160; These strategy objects are shielded from your domain class by means of Allors base classes (generated for you from the &amp;quot;repository explorer&amp;quot;).&amp;#160; Your domain is thus heavily tied to the &lt;a href=&quot;http://www.allors.com&quot; target=&quot;_blank&quot;&gt;Allors&lt;/a&gt; platform.&amp;#160; All objects are completely managed, they are created within a session which acts as a unit of work/Identity Map that can be committed/rollback entirely.&lt;/p&gt;  &lt;p&gt;&lt;a href=&quot;http://www.allors.com&quot; target=&quot;_blank&quot;&gt;Allors&lt;/a&gt; tries to make relationships first class citizens into the development process.&amp;#160; A relation should be considered as important as an object because a lot of what your object can or can&#39;t do depends on having such a relationship.&amp;#160; (For example consider a relation between a person and a email.&amp;#160; If that relation does not exists then the person cannot be emailed and a &#39;SendEmail&#39; method on the object would make no sense).&amp;#160; Every relation between objects is completely managed, all relations are by default bi-directional and both ends of it are maintained by the platform (see later &#39;what I like about Allors). &lt;/p&gt;  &lt;p&gt;Allors chooses to not give the developer all the options.&amp;#160; All the objects are loading with their value objects in them, in their strategy object that is.&amp;#160; Once you need a relation to another object that object (or many objects depending on your relation cardinality) is lazy loaded.&amp;#160; All access to variables is delegated to the strategy objects.&amp;#160; There the lazy loading can be initiated if possible (lazy loading is possible if your strategy is based on a database, if the strategy is disconnected you might nog be able to load it afterwards), nothing happens through code manipulation or reflection.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;What is NHibernate&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;NHibernate&#39;s domain model has no links with other assemblies what so ever.&amp;#160; This is keeps your domain model lean and mean and involves no learning curve to build up your domain.&amp;#160; However persistence is handled through mapping files/attributes.&amp;#160; You can specify a ton of properties in here so it will take time to get this tweaked and completely learned.&amp;#160; The major benefit of this NHibernate is that it can work with both existing databases as newly created (your ddl can be generation from &lt;a href=&quot;http://www.hibernate.org/362.html&quot; target=&quot;_blank&quot;&gt;Nhibernate&lt;/a&gt;). &lt;/p&gt;  &lt;p&gt;Focus with &lt;a href=&quot;http://www.hibernate.org/362.html&quot; target=&quot;_blank&quot;&gt;Nhibernate&lt;/a&gt; lies towards mapping your domain objects into your database.&amp;#160; It is focused on the object themselves and how to get them persisted into a database.&amp;#160; All the rest is just standard behavior of .Net, meaning that a bi-directional relation is considered as two separate ones.&amp;#160; You have to keep your domain in sync yourself.&lt;/p&gt;  &lt;p&gt;As already mentioned NHibernate lets you specify the mapping between your object and your tables.&amp;#160; While doing so you have a ton of options you can set.&amp;#160; Different fetching strategies, Caching, setting variables through reflection (not exposing anything you don&#39;t want)...&amp;#160; All is possible.&amp;#160; It uses interceptors and code emitting to get all these things done without letting the persistence code into the domain.&amp;#160; To do this you have to take some things under consideration (always create default constructor, make properties virtual in order to have them lazy loaded, ...).&amp;#160; What ever happens with a sealed class??&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;High level Comparison Table&lt;/strong&gt;&lt;/p&gt;  &lt;table cellspacing=&quot;0&quot; cellpadding=&quot;2&quot; width=&quot;456&quot; border=&quot;0&quot;&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td valign=&quot;top&quot; width=&quot;229&quot;&gt;&lt;strong&gt;&lt;u&gt;NHibernate&lt;/u&gt;&lt;/strong&gt;&lt;/td&gt;        &lt;td valign=&quot;top&quot; width=&quot;225&quot;&gt;&lt;strong&gt;&lt;u&gt;Allors&lt;/u&gt;&lt;/strong&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign=&quot;top&quot; width=&quot;229&quot;&gt;Persistence Ignorant&lt;/td&gt;        &lt;td valign=&quot;top&quot; width=&quot;225&quot;&gt;Managed Object&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign=&quot;top&quot; width=&quot;229&quot;&gt;Object Driven&lt;/td&gt;        &lt;td valign=&quot;top&quot; width=&quot;225&quot;&gt;Relation Driven&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign=&quot;top&quot; width=&quot;229&quot;&gt;Lots of configuration and fine tuning possible&lt;/td&gt;        &lt;td valign=&quot;top&quot; width=&quot;225&quot;&gt;Defaults by Allors&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign=&quot;top&quot; width=&quot;229&quot;&gt;Both New and Existing database schemes&lt;/td&gt;        &lt;td valign=&quot;top&quot; width=&quot;225&quot;&gt;Only Managed by Allors&lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;&lt;strong&gt;What I like about Allors (compared to NHibernate with my current knowledge)&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;Check the following code:&amp;#160; Your domain model has two objects. A Person and an Address, the relationship between these two is a one-to-one, meaning that any address can be used for one person and one person can have only one address.&amp;#160; Some code:&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;div class=&quot;wlWriterSmartContent&quot; id=&quot;scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:798772e2-ea08-4801-8d55-c94aa607ecb5&quot; style=&quot;padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px&quot;&gt;&lt;pre style=&quot;background-color:White;;overflow: auto;&quot;&gt;&lt;div&gt;&lt;!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

--&gt;&lt;span style=&quot;color: #008080; &quot;&gt; 1&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;Person person1 &lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;new&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; Person();
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt; 2&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;Person person2 &lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;new&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; Person();
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt; 3&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;Address address1 &lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;new&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; Address();
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt; 4&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;Address address2 &lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0000FF; &quot;&gt;new&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; Address();
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt; 5&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt; 6&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;person1.Addresss&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; address1;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt; 7&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;person2.Addresss&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; address2;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt; 8&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt; 9&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: #008000; &quot;&gt;//&lt;/span&gt;&lt;span style=&quot;color: #008000; &quot;&gt; Switch one-to-one relation&lt;/span&gt;&lt;span style=&quot;color: #008000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;10&lt;/span&gt; &lt;span style=&quot;color: #008000; &quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;person2.Address &lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt; address1;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;11&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;12&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: #008000; &quot;&gt;//&lt;/span&gt;&lt;span style=&quot;color: #008000; &quot;&gt; Check that managed objects are correctly relinked&lt;/span&gt;&lt;span style=&quot;color: #008000; &quot;&gt;
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;13&lt;/span&gt; &lt;span style=&quot;color: #008000; &quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: #000000; &quot;&gt;Assert.IsFalse(person1.ExistAddress);
&lt;/span&gt;&lt;span style=&quot;color: #008080; &quot;&gt;14&lt;/span&gt; &lt;span style=&quot;color: #000000; &quot;&gt;Assert.IsFalse(address2.ExistPersoon);&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;!-- Code inserted with Steve Dunn&#39;s Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --&gt;&lt;/div&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;The above test would go green with Allors, but with I don&#39;t know what happens with NHibernate.&amp;#160; It will mostly depends on the mapping configuration you have specified.&amp;#160; If you make the FK index unique I think you will get a FK Constraint violation??&amp;#160; If you don&#39;t make it unique your domain model will go out of synch with what you are trying to do/or you would have to get the objects in memory en remove the associations from them.&amp;#160; I&#39;ll be doing a little spike in order of how these situations reaction (Still have to look into all the configurations possible before I can do that).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Where do we go from here&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The next blog post will handle about the domain I will be building in order to make an adequate and more in depth comparison between both frameworks.&amp;#160; The domain model will be about an invoicing application build in the simplest of way. That way I can as well check how future proof both frameworks are when you want to extend/update your database schemes and do some refactorings.&lt;/p&gt;

&lt;p&gt;See you next time.&lt;/p&gt;  </description><link>http://patrickdeboeck.blogspot.com/2008/05/allors-vs-nhibernate.html</link><author>noreply@blogger.com (Patrick)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8902397729199783860.post-501102361625089890</guid><pubDate>Wed, 30 Apr 2008 20:24:00 +0000</pubDate><atom:updated>2008-05-01T14:00:21.201+02:00</atom:updated><title>NHibernate here we come !</title><description>&lt;p&gt;Currently we are starting up a project to rewrite the security service.&amp;#160; The previous version was build using data sets (argh it even gives me the creeps just writing this word), relying heavily on the database.&amp;#160; For every change (big or small) on the user profile the entire thing was deleted out of the database and the new version was inserted.&amp;#160; It even came this far that with large profiles, the timeout of the web service was hit and the application refused to work altogether.&amp;#160; Lessons learned from this debacle, we decided to build a clean domain model and use a &lt;a href=&quot;http://www.martinfowler.com/eaaCatalog/unitOfWork.html&quot; target=&quot;_blank&quot;&gt;UnitOfWork&lt;/a&gt; to decide what needs to be saved into the database.&amp;#160; We added features like &lt;a href=&quot;http://www.martinfowler.com/eaaCatalog/lazyLoad.html&quot; target=&quot;_blank&quot;&gt;lazy loading&lt;/a&gt; and caching as well to avoid database payloads.&amp;#160; Then we decided, based on the patterns already examined, we would need an ORM.&amp;#160; We looked at some possibilities (&lt;a href=&quot;http://www.allors.com&quot; target=&quot;_blank&quot;&gt;Allors&lt;/a&gt;, &lt;a href=&quot;http://www.hibernate.org/362.html&quot; target=&quot;_blank&quot;&gt;NHibernate&lt;/a&gt;, ...) , did some spikes and decided that when building a &lt;a href=&quot;http://blogs.msdn.com/dsimmons/archive/2007/06/02/persistence-ignorance-ok-i-think-i-get-it-now.aspx&quot; target=&quot;_blank&quot;&gt;Persistence Ignorant domain model&lt;/a&gt;, &lt;a href=&quot;http://www.hibernate.org/362.html&quot; target=&quot;_blank&quot;&gt;Nhibernate&lt;/a&gt; was the best choice.&lt;/p&gt;  &lt;p&gt;We presented our findings and spike results along with our proposed solution to the enterprise architects.&amp;#160; It was turned down for no apparent reason.&amp;#160; Their solution was to align with the rest of the organization and go for a data-driven approach (they even mentioned data sets) and thus avoid complex domains that need mapping through a tool.&amp;#160; In case of caching, we were told to write it in stored procedures (because that is why they are there for :-)).&amp;#160; &amp;quot;Why on earth did we even have a complex domain model&amp;quot; was the last question of the meeting.&amp;#160; This coming from a team&amp;#160; that believes that writing unit tests is more time consuming than it is beneficial.&amp;#160; Wait until they have to maintain one of these data-driven applications :-).&amp;#160; &lt;/p&gt;  &lt;p&gt;We lost this battle, but we didn&#39;t surrender our fight.&amp;#160; We already assembled some followers: &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;The DBA team loved the caching and the reduced database hits. &lt;/li&gt;    &lt;li&gt;Other development teams were experiencing the same problems so were asking for similar solutions.&amp;#160; &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Long story short, the decision to use it or not was postponed until a meeting were both us and the A-Team would present our cases.&amp;#160; The meeting was last Monday and given this blog posts title our arguments have won it. &lt;/p&gt;  &lt;p&gt;Thank God because we already started on the ground work of our own ORM and it would take a lot of work to build the features we are now getting for free!&amp;#160; We&#39;ve worked about two weeks on it and I think we could cover about 75% percent of our basic CRUD operations.&amp;#160; We didn&#39;t yet added support for collections the UnitOfWork, but we already had ideas about how to do it (build a custom persistent collection for it).&amp;#160; Our implementation depended heavily on the dynamic proxy of &lt;a href=&quot;http://www.castleproject.org/container/index.html&quot; target=&quot;_blank&quot;&gt;castle project&lt;/a&gt; and was inspired by the NHibernate source code.&amp;#160; Writing it ourselves made me think about this scene from the matrix were Morpheus asked Neo to take the blue pill and stay ignorant (about persistence issues) or take the red pill and see what really going on.&amp;#160; We were forced to take the red pill or doom the project before it even began.&amp;#160; It was fun to experiment with it, but when your problem domain is security, that should be the focus of your development all time you spent on infrastructure code is time wasted!&lt;/p&gt;  &lt;p&gt;Anyway we are going to test NHibernate in our project, then it will be evaluated and eventually rolled out to the rest of the development teams. Lets start reading about &lt;a href=&quot;http://www.manning.com/kuate/&quot; target=&quot;_blank&quot;&gt;it&lt;/a&gt;!&lt;/p&gt;  &lt;p&gt;See ya next time.&lt;/p&gt;  &lt;div class=&quot;wlWriterSmartContent&quot; id=&quot;scid:0767317B-992E-4b12-91E0-4F059A8CECA8:7c736df1-fb35-4551-9f49-923aa1ae0c9a&quot; style=&quot;padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px&quot;&gt;Tags van Technorati: &lt;a href=&quot;http://technorati.com/tags/NHibernate&quot; rel=&quot;tag&quot;&gt;NHibernate&lt;/a&gt;,&lt;a href=&quot;http://technorati.com/tags/ORM&quot; rel=&quot;tag&quot;&gt;ORM&lt;/a&gt;&lt;/div&gt;  </description><link>http://patrickdeboeck.blogspot.com/2008/04/nhibernate-here-we-come.html</link><author>noreply@blogger.com (Patrick)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8902397729199783860.post-8137645523187571806</guid><pubDate>Sun, 27 Apr 2008 12:13:00 +0000</pubDate><atom:updated>2008-04-27T14:13:44.331+02:00</atom:updated><title>Methodology</title><description>&lt;p&gt;I am a big fan of &lt;a href=&quot;http://en.wikipedia.org/wiki/Agile_software_development&quot; target=&quot;_blank&quot;&gt;agile methodologies&lt;/a&gt;.&amp;#160; In my opinion they are the only way one can guarantee (can you ever??) the delivery of the project.&lt;/p&gt;  &lt;p&gt;Benefits of agile development are already widely known by the developers.&amp;#160; But the persons who control the budget usually are not aware about these.&amp;#160; So here is a short list in case you have to convince them :-)&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Improved return on investment (RIO) &lt;/li&gt;    &lt;li&gt;Early detection and cancellation of failing products &lt;/li&gt;    &lt;li&gt;Higher quality software &lt;/li&gt;    &lt;li&gt;Improved control of a project &lt;/li&gt;    &lt;li&gt;Reduced dependence on individuals and increased flexibility &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;One of the cornerstones of my development process is automatic testing.&amp;#160; Writing your tests in advance (&lt;a href=&quot;http://en.wikipedia.org/wiki/Test-driven_development&quot; target=&quot;_blank&quot;&gt;Test Driven Development&lt;/a&gt;) is better because then every feature you put into production code is checked by automatic tests.&amp;#160; I must say I violate the principle of writing tests first occasionally, but all my code must be covered before I can ship it.&lt;/p&gt;  &lt;p&gt;At my current job we are working according to the &lt;a href=&quot;http://en.wikipedia.org/wiki/Scrum_(development)&quot; target=&quot;_blank&quot;&gt;Scrum methodology&lt;/a&gt;. The organization has a more &#39;analysis first&#39; belief therefor we cannot completely follow the Scrum principles.&amp;#160; But time is changing.... hopefully!!&amp;#160; &lt;/p&gt;  &lt;div class=&quot;wlWriterSmartContent&quot; id=&quot;scid:0767317B-992E-4b12-91E0-4F059A8CECA8:4952102e-c40e-481a-968f-2e4ce8965cf2&quot; style=&quot;padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px&quot;&gt;Tags van Technorati: &lt;a href=&quot;http://technorati.com/tags/methodology&quot; rel=&quot;tag&quot;&gt;methodology&lt;/a&gt;,&lt;a href=&quot;http://technorati.com/tags/agile&quot; rel=&quot;tag&quot;&gt;agile&lt;/a&gt;,&lt;a href=&quot;http://technorati.com/tags/TDD&quot; rel=&quot;tag&quot;&gt;TDD&lt;/a&gt;&lt;/div&gt;  </description><link>http://patrickdeboeck.blogspot.com/2008/04/methodology.html</link><author>noreply@blogger.com (Patrick)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8902397729199783860.post-8427927833851683785</guid><pubDate>Sat, 26 Apr 2008 10:42:00 +0000</pubDate><atom:updated>2008-04-26T12:45:16.912+02:00</atom:updated><title>My open source project</title><description>&lt;p&gt;As outlined in my previous post, I am working on &lt;a href=&quot;http://www.allors.com&quot; target=&quot;_blank&quot;&gt;Allors&lt;/a&gt; in my spare time.&amp;#160; This project enables you to focus on your problem domain instead of most infrastructure code.&amp;#160; It is not exactly an &lt;a href=&quot;http://en.wikipedia.org/wiki/Object-relational_mapping&quot; target=&quot;_blank&quot;&gt;ORM mapper&lt;/a&gt; because is does not do mapping for you. If you decide the persistence layer should be a database, that database scheme is created for.&amp;#160; It uses different strategies to &#39;save&#39; your object with the &lt;a href=&quot;http://en.wikipedia.org/wiki/Active_record_pattern&quot; target=&quot;_blank&quot;&gt;active record&lt;/a&gt; principle.&lt;/p&gt;  &lt;p&gt;In the following series of posts I will be building an Accounting program to track my customers and my contracts with them.&amp;#160; I could then enter my timesheets and generate my invoices directly from them.&amp;#160; &lt;/p&gt;  &lt;p&gt;The main idea about the series is to show how easy you can model your domain and demonstrate the strong points of our framework.&lt;/p&gt;  &lt;p&gt;Stick with me or subscribe to my feed at: &lt;a title=&quot;http://feeds.feedburner.com/ComeTalkAWalkWithMe&quot; href=&quot;http://feeds.feedburner.com/ComeTalkAWalkWithMe&quot;&gt;http://feeds.feedburner.com/ComeTalkAWalkWithMe&lt;/a&gt;&lt;/p&gt;  &lt;div class=&quot;wlWriterSmartContent&quot; id=&quot;scid:0767317B-992E-4b12-91E0-4F059A8CECA8:196dd320-099c-42de-80a8-d2c9808a2673&quot; style=&quot;padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px&quot;&gt;Tags van Technorati: &lt;a href=&quot;http://technorati.com/tags/Open%20Source&quot; rel=&quot;tag&quot;&gt;Open Source&lt;/a&gt;,&lt;a href=&quot;http://technorati.com/tags/Allors&quot; rel=&quot;tag&quot;&gt;Allors&lt;/a&gt;&lt;/div&gt;  </description><link>http://patrickdeboeck.blogspot.com/2008/04/my-open-source-project.html</link><author>noreply@blogger.com (Patrick)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-8902397729199783860.post-3072601719889188077</guid><pubDate>Fri, 25 Apr 2008 22:33:00 +0000</pubDate><atom:updated>2008-04-26T00:33:58.621+02:00</atom:updated><title>Getting Started</title><description>&lt;p&gt;A couple of weeks ago I decided that I should get a blog.&amp;#160; Why one might ask, why do we need another blog in this world?&amp;#160; The answer is fairly simple, I need a blog as a reference for myself.&amp;#160; I need a blog to improve my writing skills and I need a blog because &lt;a href=&quot;http://vanryswyckjan.blogspot.com/&quot; target=&quot;_blank&quot;&gt;Jan&lt;/a&gt; told me (just kidding of course).&lt;/p&gt;  &lt;p&gt;If you care to know me more personally I invite you to read my profile. professionally I am developing software ever since the millennium bug.&amp;#160; I started out at &lt;a href=&quot;http://www.capco.com&quot; target=&quot;_blank&quot;&gt;Capco&lt;/a&gt;, doing consultancy work in Java across Europe (Antwerp, London, Frankfurt, Luxemburg).&amp;#160; I then switched to &lt;a href=&quot;http://www.msp.be/&quot; target=&quot;_blank&quot;&gt;MSP&lt;/a&gt; and .Net.&amp;#160; For them I became the lead developer/architect on a major insurance project in Eindhoven.&amp;#160; In 2004 I decided to take a leap into the dark.&amp;#160; I quit my job and started my own company (PDBC-Systems).&lt;/p&gt;  &lt;p&gt;Currently I have a contract at &lt;a href=&quot;http://www.sd.be&quot; target=&quot;_blank&quot;&gt;SD WORX&lt;/a&gt; (signed thank to &lt;a href=&quot;http://www.inxin.com&quot; target=&quot;_blank&quot;&gt;Inxin&lt;/a&gt;) where I am working on the new security component.&amp;#160; It is built using .NET 3.0 exposing a WCF service on the back-end and a WPF application on the client-side.&amp;#160; My blog will probably be filled with anecdotes about this project.&lt;/p&gt;  &lt;p&gt;In my spare time I participate on an Open-Source project called &lt;a href=&quot;https://www.allors.com/trac&quot; target=&quot;_blank&quot;&gt;Allors&lt;/a&gt;.&amp;#160; Allors is a domain driven enabler!&amp;#160; You create a meta domain by using the repository browser, afterwards Stringtemplate takes care of the code generation to build your domain objects.&amp;#160; By using different strategies (memory, SQL, oracle, ...) you can map your domain to different persistence methods.&amp;#160; A fair amount of blog posts will probably be Allors inspired.&lt;/p&gt;  </description><link>http://patrickdeboeck.blogspot.com/2008/04/getting-started.html</link><author>noreply@blogger.com (Patrick)</author><thr:total>0</thr:total></item></channel></rss>