﻿<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:blogChannel="http://backend.userland.com/blogChannelModule" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#">
  <channel>
    <title>blog.fossmo.net</title>
    <description>"There is nothing permanent except change"</description>
    <link>http://blog.fossmo.net/</link>
    <docs>http://www.rssboard.org/rss-specification</docs>
    <generator>BlogEngine.NET 1.4.5.0</generator>
    <language>en-GB</language>
    <blogChannel:blogRoll>http://blog.fossmo.net/opml.axd</blogChannel:blogRoll>
    <blogChannel:blink>http://blog.fossmo.net/SyndicationService.asmx/GetRss</blogChannel:blink>
    <dc:creator>fossmo</dc:creator>
    <dc:title>blog.fossmo.net</dc:title>
    <item>
      <title>Talking at Norwegian .NET User Group next thursday</title>
      <description>&lt;p&gt;
The last three years I have been working for a customer in Trondheim, Norway, building a application based on Windows Presentation Foundation (yeah, I know it&amp;#39;s not the hottest stuff), SQL Server, Entity Framework 4.1 (Code first) and a cool scalable architecture. At the user group meeting I will present how we buildt the architecture and how we solved the problems around scalability. I&amp;#39;m looking forward to presenting this stuff for the user group and hope to see you there!!
&lt;/p&gt;
&lt;p&gt;
Sign up for the meeting at&amp;nbsp;&lt;a href="http://www.nnug.no/Avdelinger/Trondheim/Moter/NNUG-Trondheim---29-september-2011/" target="_blank"&gt;http://www.nnug.no/Avdelinger/Trondheim/Moter/NNUG-Trondheim---29-september-2011/&amp;nbsp;&lt;/a&gt;
&lt;/p&gt;
</description>
      <link>http://blog.fossmo.net/post/Talking-at-Norwegian-NET-User-Group-next-thursday.aspx</link>
      <author>fossmo.nospam@nospam.fossmo.net (fossmo)</author>
      <comments>http://blog.fossmo.net/post/Talking-at-Norwegian-NET-User-Group-next-thursday.aspx#comment</comments>
      <guid>http://blog.fossmo.net/post.aspx?id=c4f4df9a-5d2d-4e8a-8f09-cda6c0600713</guid>
      <pubDate>Sat, 24 Sep 2011 09:49:00 -0400</pubDate>
      <category>CQRS</category>
      <category>Database</category>
      <category>DDD</category>
      <category>WPF</category>
      <dc:publisher>fossmo</dc:publisher>
      <pingback:server>http://blog.fossmo.net/pingback.axd</pingback:server>
      <pingback:target>http://blog.fossmo.net/post.aspx?id=c4f4df9a-5d2d-4e8a-8f09-cda6c0600713</pingback:target>
      <slash:comments>0</slash:comments>
      <trackback:ping>http://blog.fossmo.net/trackback.axd?id=c4f4df9a-5d2d-4e8a-8f09-cda6c0600713</trackback:ping>
      <wfw:comment>http://blog.fossmo.net/post/Talking-at-Norwegian-NET-User-Group-next-thursday.aspx#comment</wfw:comment>
      <wfw:commentRss>http://blog.fossmo.net/syndication.axd?post=c4f4df9a-5d2d-4e8a-8f09-cda6c0600713</wfw:commentRss>
    </item>
    <item>
      <title>How to set up spaces in Vim?</title>
      <description>&lt;p&gt;To use spaces instead of tabs in VIM, add these lines to your .vimrc file:&lt;/p&gt;  &lt;p&gt;set tabstop=3&lt;/p&gt;  &lt;p&gt;set shiftwidth=3&lt;/p&gt;  &lt;p&gt;set expandtab&lt;/p&gt;</description>
      <link>http://blog.fossmo.net/post/How-to-set-up-spaces-in-Vim.aspx</link>
      <author>fossmo.nospam@nospam.fossmo.net (fossmo)</author>
      <comments>http://blog.fossmo.net/post/How-to-set-up-spaces-in-Vim.aspx#comment</comments>
      <guid>http://blog.fossmo.net/post.aspx?id=460be9a3-95e7-44de-ab60-f0c4e8965a4e</guid>
      <pubDate>Tue, 26 Oct 2010 17:30:21 -0400</pubDate>
      <category>VIM</category>
      <dc:publisher>fossmo</dc:publisher>
      <pingback:server>http://blog.fossmo.net/pingback.axd</pingback:server>
      <pingback:target>http://blog.fossmo.net/post.aspx?id=460be9a3-95e7-44de-ab60-f0c4e8965a4e</pingback:target>
      <slash:comments>0</slash:comments>
      <trackback:ping>http://blog.fossmo.net/trackback.axd?id=460be9a3-95e7-44de-ab60-f0c4e8965a4e</trackback:ping>
      <wfw:comment>http://blog.fossmo.net/post/How-to-set-up-spaces-in-Vim.aspx#comment</wfw:comment>
      <wfw:commentRss>http://blog.fossmo.net/syndication.axd?post=460be9a3-95e7-44de-ab60-f0c4e8965a4e</wfw:commentRss>
    </item>
    <item>
      <title>WCF Data Services: A perfect fit for our CQRS implementation</title>
      <description>&lt;p&gt;
&lt;img style="width: 172px; height: 81px" src="http://blog.fossmo.net/image.axd?picture=2010%2f6%2f3261364899_278ffbbabb.jpg" alt="" width="278" height="302" align="left" /&gt;When we started implementing CQRS architecture in the project I&amp;#39;m working on at the moment, we used NHibernate to get the data from the database on the query side and to the view model in the GUI. This worked fine, but it took a bit of time to implement what was needed to get the data through &amp;ldquo;all&amp;rdquo; the layers and to the GUI. It was tedious and error prone. 
&lt;/p&gt;
&lt;p&gt;
We started to look for other ways to do this. We considered using plain SQL through ADO.NET, but we wanted something that was simpler and faster to implement. By using ADO.NET we still had to create web services and do a bit of mapping. WCF Data Services ended up being our &amp;ldquo;savior&amp;rdquo;. 
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;A quick update on WCF Data Services&lt;/strong&gt; 
&lt;/p&gt;
&lt;p&gt;
WCF Data Services is built upon the open data protocol (OData), and OData is built upon the atompub protocol. OData is developed at Microsoft, but published as a open standard. You can read more about it at &lt;a href="http://www.odata.org"&gt;www.odata.org&lt;/a&gt;. I think OData is very exciting, and there are already other languages supporting this protocol besides .NET. To mention some; PHP and Java. &lt;br /&gt;
A cool thing; If a data store have a LINQ provider, it&amp;rsquo;s possible to expose the data through the OData protocol using WCF Data Services in few simple steps. If I&amp;rsquo;m not mistaken, there is a provider for db4o and a provider under development for MongoDB. 
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;How we did it&lt;/strong&gt; 
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://blog.fossmo.net/image.axd?picture=WindowsLiveWriter/WCFDataServicesAperfectfitforourCQRSimpl/6312FF92/image.png"&gt;&lt;img style="margin: 0px 10px 0px 0px; display: inline; border-width: 0px" src="http://blog.fossmo.net/image.axd?picture=WindowsLiveWriter/WCFDataServicesAperfectfitforourCQRSimpl/69C60915/image_thumb.png" border="0" alt="image" title="image" width="244" height="145" /&gt;&lt;/a&gt; &lt;br /&gt;
&lt;br /&gt;
To set up WCF DS over the read database, the only thing we had to do, was to create the table(s) we wanted exposed through WCF DS. Add a EDMX model to a empty ASP.NET web project, and finally add a WCF Data Service to the web project and added the entity set as a datasource (We also added some security, but when it comes to security in the OData protocol, you&amp;rsquo;re on your own. OData doesn&amp;rsquo;t say anything about how you should do this). 
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;&lt;a href="http://blog.fossmo.net/image.axd?picture=WindowsLiveWriter/WCFDataServicesAperfectfitforourCQRSimpl/6DD056E7/image.png"&gt;&lt;img style="display: inline; border-width: 0px" src="http://blog.fossmo.net/image.axd?picture=WindowsLiveWriter/WCFDataServicesAperfectfitforourCQRSimpl/62A6CC9D/image_thumb.png" border="0" alt="image" title="image" width="244" height="140" /&gt;&lt;/a&gt; 
&lt;/p&gt;
&lt;p&gt;
So, to fetch data into the view model in the presentation layer, we simply use a LINQ query to get the data we want. &lt;a href="http://msdn.microsoft.com/en-us/library/system.data.services.client.dataservicecontext.aspx" target="_blank"&gt;DataServiceContext&lt;/a&gt; is one of the main actors in this process. The result from the query is added to the presentation model. WCF DS comes with a object-to-object mapper that makes the job mapping to the presentation model very simple. You can set it up to map all the properties in the presentation model, and throw an exception if a property is missing, or set it up to ignore missing properties. &lt;br /&gt;
A small code example: 
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;DataServiceContext context = new DataServiceContext(...); &lt;br /&gt;
context.IgnoreMissingProperties = true;&lt;/strong&gt; 
&lt;/p&gt;
&lt;p&gt;
The OData protocol gives us a lot of stuff for free; like getting the top ten records, paging, sorting, and other stuff you expect when querying a relational database. And this is just some of the abilities you get with WCF DS. Read about the conventions at &lt;a href="http://www.odata.org/developers/protocols/uri-conventions"&gt;http://www.odata.org/developers/protocols/uri-conventions&lt;/a&gt; 
&lt;/p&gt;
&lt;p&gt;
This has simplified the process of adding new view models to the query side and have made us more productive. 
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Although we only have implemented this on the query side, I see no problems using the same approach on the command side.&lt;/strong&gt; 
&lt;/p&gt;
</description>
      <link>http://blog.fossmo.net/post/WCF-Data-Services-A-perfect-fit-for-our-CQRS-implementation.aspx</link>
      <author>fossmo.nospam@nospam.fossmo.net (fossmo)</author>
      <comments>http://blog.fossmo.net/post/WCF-Data-Services-A-perfect-fit-for-our-CQRS-implementation.aspx#comment</comments>
      <guid>http://blog.fossmo.net/post.aspx?id=4a78d6ce-19fd-4190-881b-5a3182dbd027</guid>
      <pubDate>Wed, 19 May 2010 15:47:00 -0400</pubDate>
      <category>CQRS</category>
      <dc:publisher>fossmo</dc:publisher>
      <pingback:server>http://blog.fossmo.net/pingback.axd</pingback:server>
      <pingback:target>http://blog.fossmo.net/post.aspx?id=4a78d6ce-19fd-4190-881b-5a3182dbd027</pingback:target>
      <slash:comments>0</slash:comments>
      <trackback:ping>http://blog.fossmo.net/trackback.axd?id=4a78d6ce-19fd-4190-881b-5a3182dbd027</trackback:ping>
      <wfw:comment>http://blog.fossmo.net/post/WCF-Data-Services-A-perfect-fit-for-our-CQRS-implementation.aspx#comment</wfw:comment>
      <wfw:commentRss>http://blog.fossmo.net/syndication.axd?post=4a78d6ce-19fd-4190-881b-5a3182dbd027</wfw:commentRss>
    </item>
    <item>
      <title>Slides and code from my lightningtalk at NNUG</title>
      <description>&lt;br /&gt;
Yesterday I held a presentation at NNUG about NServicebus. The code and the 
slide were requested by some. Here you go:
&lt;p&gt;
&lt;a href="http://blog.fossmo.net/file.axd?file=2010%2f4%2fNServicebus.pdf"&gt;NServicebus.pdf (754.20 kb)&lt;/a&gt;&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://blog.fossmo.net/file.axd?file=2010%2f4%2fNServicebusExample.zip"&gt;NServicebusExample.zip (5.28 mb)&lt;/a&gt;
&lt;/p&gt;
</description>
      <link>http://blog.fossmo.net/post/Slides-and-code-from-my-lightningtalk-at-NNUG.aspx</link>
      <author>fossmo.nospam@nospam.fossmo.net (fossmo)</author>
      <comments>http://blog.fossmo.net/post/Slides-and-code-from-my-lightningtalk-at-NNUG.aspx#comment</comments>
      <guid>http://blog.fossmo.net/post.aspx?id=16e2aebd-abab-4c2c-9b9d-0d88179acf31</guid>
      <pubDate>Fri, 30 Apr 2010 02:37:00 -0400</pubDate>
      <category>C#</category>
      <category>Presentation</category>
      <category>Speaker</category>
      <dc:publisher>fossmo</dc:publisher>
      <pingback:server>http://blog.fossmo.net/pingback.axd</pingback:server>
      <pingback:target>http://blog.fossmo.net/post.aspx?id=16e2aebd-abab-4c2c-9b9d-0d88179acf31</pingback:target>
      <slash:comments>2</slash:comments>
      <trackback:ping>http://blog.fossmo.net/trackback.axd?id=16e2aebd-abab-4c2c-9b9d-0d88179acf31</trackback:ping>
      <wfw:comment>http://blog.fossmo.net/post/Slides-and-code-from-my-lightningtalk-at-NNUG.aspx#comment</wfw:comment>
      <wfw:commentRss>http://blog.fossmo.net/syndication.axd?post=16e2aebd-abab-4c2c-9b9d-0d88179acf31</wfw:commentRss>
    </item>
    <item>
      <title>Renewal of MVP status</title>
      <description>&lt;p&gt;About one week ago (1. April) I got a very cool email from Microsoft. I was re-rewarded as a MVP. Thank you Microsoft! The main reason for me getting this award, I guess, is my work for the community. Speaking about community; I'm going to hold a lightning talk at the next &lt;a href="http://www.nnug.no"&gt;NNUG meeting in Trondheim&lt;/a&gt; and I'm also going to hold a lightning talk at &lt;a href="http://xp2010.org/"&gt;XP2010&lt;/a&gt;. Hope to see you there?&lt;/p&gt;</description>
      <link>http://blog.fossmo.net/post/Renewal-of-MVP-status.aspx</link>
      <author>fossmo.nospam@nospam.fossmo.net (fossmo)</author>
      <comments>http://blog.fossmo.net/post/Renewal-of-MVP-status.aspx#comment</comments>
      <guid>http://blog.fossmo.net/post.aspx?id=7515a015-ed1a-42d6-aaec-c7c3728fc993</guid>
      <pubDate>Wed, 07 Apr 2010 03:46:06 -0400</pubDate>
      <category>Speaker</category>
      <category>NNUG</category>
      <dc:publisher>fossmo</dc:publisher>
      <pingback:server>http://blog.fossmo.net/pingback.axd</pingback:server>
      <pingback:target>http://blog.fossmo.net/post.aspx?id=7515a015-ed1a-42d6-aaec-c7c3728fc993</pingback:target>
      <slash:comments>0</slash:comments>
      <trackback:ping>http://blog.fossmo.net/trackback.axd?id=7515a015-ed1a-42d6-aaec-c7c3728fc993</trackback:ping>
      <wfw:comment>http://blog.fossmo.net/post/Renewal-of-MVP-status.aspx#comment</wfw:comment>
      <wfw:commentRss>http://blog.fossmo.net/syndication.axd?post=7515a015-ed1a-42d6-aaec-c7c3728fc993</wfw:commentRss>
    </item>
    <item>
      <title>CQRS made us more productive</title>
      <description>&lt;p&gt;The last year I have been working at a customer creating a product with a fairly complex domain model. We started of by using a DDD approach, creating a domain model, repositories, domain services, application services, thinking bounded context, using aggregates and aggregate roots. The application were based on recommendations from Evans book. Everything worked pretty well, except for one thing; we had to do a lot of mapping between the “layers” in the application. Some of it couldn’t be avoided, and luckily some of it could. One thing that bugged me was all the effort we had to go through just to show some data in the GUI.&lt;/p&gt;  &lt;p&gt;When showing data, the data had to be dragged through all the “layers”. This felt a bit meaningless because the data didn’t have to be validated in any way, and they for sure didn’t touch any business rules on their way up.&lt;/p&gt;  &lt;p&gt;We then started to look for other solutions, and discovered Command Query Responsibility Segregation. In CQRS the application is split into to parts; one where you only can query for data and one you only can write data. I wont go into the technical parts of how this is done in this post, but rather focus on what it have given us concerning productivity. Instead of having to focus on pulling data through n-layers just to show the data in the UI, we could put our effort into creating a more user friendly UI and and focus on important things like cranking out more functionality for the product owner. The commands in CQRS fell naturally into the ubiquitous language and it made us focused on the what the user really wants when he executes a action in the GUI.&lt;/p&gt;  &lt;p&gt;And maybe one of the best things are that we still used the good practices from Domain Driven Design in our application. We have of course had problems, but all in all we have had more positive effects than negative.&lt;/p&gt;  &lt;p&gt;Anyone had a similar experience?&lt;/p&gt;</description>
      <link>http://blog.fossmo.net/post/CQRS-made-us-more-productive.aspx</link>
      <author>fossmo.nospam@nospam.fossmo.net (fossmo)</author>
      <comments>http://blog.fossmo.net/post/CQRS-made-us-more-productive.aspx#comment</comments>
      <guid>http://blog.fossmo.net/post.aspx?id=40704ecf-af50-463d-9ef3-9266b31eb2a1</guid>
      <pubDate>Wed, 10 Mar 2010 17:41:12 -0400</pubDate>
      <category>CQRS</category>
      <dc:publisher>fossmo</dc:publisher>
      <pingback:server>http://blog.fossmo.net/pingback.axd</pingback:server>
      <pingback:target>http://blog.fossmo.net/post.aspx?id=40704ecf-af50-463d-9ef3-9266b31eb2a1</pingback:target>
      <slash:comments>3</slash:comments>
      <trackback:ping>http://blog.fossmo.net/trackback.axd?id=40704ecf-af50-463d-9ef3-9266b31eb2a1</trackback:ping>
      <wfw:comment>http://blog.fossmo.net/post/CQRS-made-us-more-productive.aspx#comment</wfw:comment>
      <wfw:commentRss>http://blog.fossmo.net/syndication.axd?post=40704ecf-af50-463d-9ef3-9266b31eb2a1</wfw:commentRss>
    </item>
    <item>
      <title>I’m doing a presentation about CQRS</title>
      <description>&lt;p&gt;
On Thursday, 4. march I will be holding a presentation about my experience using CQRS in a project for a customer. The meeting is held in Trondheim at the Vital building. During the meeting I will be giving away 2 licenses for CodeRush&amp;trade; with Refactor!&amp;trade; Pro. To participate in this event, go to &lt;a href="http://www.nnug.no"&gt;www.nnug.no&lt;/a&gt; and register there.     &lt;br /&gt;
Hope I will see you there 
&lt;/p&gt;
  
&lt;p&gt;
&lt;a href="http://blog.fossmo.net/image.axd?picture=WindowsLiveWriter/ImdoingapresentationaboutCQRS/2E71840C/1266961907_1.png"&gt;&lt;img style="display: inline; border-width: 0px" src="http://blog.fossmo.net/image.axd?picture=WindowsLiveWriter/ImdoingapresentationaboutCQRS/553F9A4C/1266961907_1_thumb.png" border="0" alt="1266961907_1" title="1266961907_1" width="128" height="128" /&gt;&lt;/a&gt;
&lt;/p&gt;
</description>
      <link>http://blog.fossmo.net/post/Ie28099m-doing-a-presentation-about-CQRS.aspx</link>
      <author>fossmo.nospam@nospam.fossmo.net (fossmo)</author>
      <comments>http://blog.fossmo.net/post/Ie28099m-doing-a-presentation-about-CQRS.aspx#comment</comments>
      <guid>http://blog.fossmo.net/post.aspx?id=944043d7-caba-42ac-9c77-d28d9d15ec97</guid>
      <pubDate>Tue, 23 Feb 2010 16:53:00 -0400</pubDate>
      <category>CQRS</category>
      <category>DDD</category>
      <dc:publisher>fossmo</dc:publisher>
      <pingback:server>http://blog.fossmo.net/pingback.axd</pingback:server>
      <pingback:target>http://blog.fossmo.net/post.aspx?id=944043d7-caba-42ac-9c77-d28d9d15ec97</pingback:target>
      <slash:comments>0</slash:comments>
      <trackback:ping>http://blog.fossmo.net/trackback.axd?id=944043d7-caba-42ac-9c77-d28d9d15ec97</trackback:ping>
      <wfw:comment>http://blog.fossmo.net/post/Ie28099m-doing-a-presentation-about-CQRS.aspx#comment</wfw:comment>
      <wfw:commentRss>http://blog.fossmo.net/syndication.axd?post=944043d7-caba-42ac-9c77-d28d9d15ec97</wfw:commentRss>
    </item>
    <item>
      <title>The denormalizer in CQRS</title>
      <description>&lt;p&gt;&lt;strong&gt;The “denormalizer” is a component responsible for mapping data from the domain model to a &lt;/strong&gt;&lt;a href="http://en.wikipedia.org/wiki/Denormalization" target="_blank"&gt;&lt;strong&gt;denormalized&lt;/strong&gt;&lt;/a&gt;&lt;strong&gt; table structure at the query side (an over can be found &lt;a href="http://blog.fossmo.net/post/Update-to-the-CQRS-figure.aspx" target="_blank"&gt;here&lt;/a&gt;). &lt;/strong&gt;Usually the denormalizer component runs as a windows service at the server hosting the query side. Its only responsibility is to move data from the command side to the query side, and function as a router for messages from the write side. You might not want the same data on all the read servers.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Database tables matching view models&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;On the query side, all the tables match a view model in the GUI. Yes, this means you will end up with some duplicated data in the database tables, but that’s ok. Hard disk space is cheap. &lt;/p&gt;  &lt;p&gt;Let’s look on how the denormalizer fits into the architecture.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blog.fossmo.net/image.axd?picture=WindowsLiveWriter/Igotaskedaquestionwhatisthedenormalizer_31/image_2.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blog.fossmo.net/image.axd?picture=WindowsLiveWriter/Igotaskedaquestionwhatisthedenormalizer_31/image_thumb.png" width="640" height="279" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;When the domain model have done its stuff, an event is raised and a message is sent through a “pipeline” to the denormalizer on the query side. The “pipeline” can be a queue or something else that is fit to move the message in a safe way. &lt;strong&gt;I have used NServicebus with a lot of success, but there are other ESBs or other ways to do this.&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Easy programming model&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;When the denormalizer receives the message, it spreads the data into the tables that needs to be updated . &lt;strong&gt;The tables have a one-to-one relationship with the view models.&lt;/strong&gt; A GUI view can have multiple view models. What this gives you is a very easy programming model on the query side. All you have to think about concerning the denormalizer, is to insert/update the data to the correct tables. From the client, you look at the data as reporting data; meaning you can’t update or insert data on the query side.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;NOSQL&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;All though I’m referring to a relational database at the query side in this post, it doesn’t have to be a relational database. You can use a non relational database if you want to.&lt;strong&gt; I would recommend MongoDB&lt;/strong&gt; over a object database like DB4o, but that’s just my taste at the moment. You can even build your own key-value store because in most GUI views you will just fetch data based on an id.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Summary&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;To sum it up; the denormalizer routs the messages from the command side in to the correct tables on the query side.&lt;/p&gt;</description>
      <link>http://blog.fossmo.net/post/The-denormalizer-in-CQRS.aspx</link>
      <author>fossmo.nospam@nospam.fossmo.net (admin)</author>
      <comments>http://blog.fossmo.net/post/The-denormalizer-in-CQRS.aspx#comment</comments>
      <guid>http://blog.fossmo.net/post.aspx?id=0b8a5fe8-67e8-49e0-917f-9a1182d94b9a</guid>
      <pubDate>Tue, 16 Feb 2010 18:06:28 -0400</pubDate>
      <dc:publisher>admin</dc:publisher>
      <pingback:server>http://blog.fossmo.net/pingback.axd</pingback:server>
      <pingback:target>http://blog.fossmo.net/post.aspx?id=0b8a5fe8-67e8-49e0-917f-9a1182d94b9a</pingback:target>
      <slash:comments>0</slash:comments>
      <trackback:ping>http://blog.fossmo.net/trackback.axd?id=0b8a5fe8-67e8-49e0-917f-9a1182d94b9a</trackback:ping>
      <wfw:comment>http://blog.fossmo.net/post/The-denormalizer-in-CQRS.aspx#comment</wfw:comment>
      <wfw:commentRss>http://blog.fossmo.net/syndication.axd?post=0b8a5fe8-67e8-49e0-917f-9a1182d94b9a</wfw:commentRss>
    </item>
    <item>
      <title>How to set permanent path in Powershell</title>
      <description>&lt;p&gt;Input in powershell window:&lt;/p&gt;  &lt;p&gt;[environment]::SetEnvironmentVariable('path',&amp;quot;$env:Path;c:\Program Files\Git\bin&amp;quot;,'Machine')&lt;/p&gt;</description>
      <link>http://blog.fossmo.net/post/How-to-set-permanent-path-in-Powershell.aspx</link>
      <author>fossmo.nospam@nospam.fossmo.net (fossmo)</author>
      <comments>http://blog.fossmo.net/post/How-to-set-permanent-path-in-Powershell.aspx#comment</comments>
      <guid>http://blog.fossmo.net/post.aspx?id=17d6aa2a-3712-49e5-b73e-cd9abf5713d6</guid>
      <pubDate>Sun, 10 Jan 2010 15:06:46 -0400</pubDate>
      <category>Powershell</category>
      <dc:publisher>fossmo</dc:publisher>
      <pingback:server>http://blog.fossmo.net/pingback.axd</pingback:server>
      <pingback:target>http://blog.fossmo.net/post.aspx?id=17d6aa2a-3712-49e5-b73e-cd9abf5713d6</pingback:target>
      <slash:comments>0</slash:comments>
      <trackback:ping>http://blog.fossmo.net/trackback.axd?id=17d6aa2a-3712-49e5-b73e-cd9abf5713d6</trackback:ping>
      <wfw:comment>http://blog.fossmo.net/post/How-to-set-permanent-path-in-Powershell.aspx#comment</wfw:comment>
      <wfw:commentRss>http://blog.fossmo.net/syndication.axd?post=17d6aa2a-3712-49e5-b73e-cd9abf5713d6</wfw:commentRss>
    </item>
    <item>
      <title>Five things to think about when working with messaging solutions</title>
      <description>&lt;p&gt;
I&amp;rsquo;m trying to gather some of my thoughts around messages and that resulted in these 5 points:
&lt;/p&gt;
&lt;p&gt;
1) A message can be created with any technology. It can be JSON, XML, Binary or a custom format. If you want to use the message in different technologies (like Java and .NET), it might be smart to go for a format supported by both technologies. Well, if you choose a technology like XML, it&amp;rsquo;s not given that you can exchange messages. XML is just a way to format your message, it doesn&amp;rsquo;t say anything about the content.
&lt;/p&gt;
&lt;p&gt;
2) A message consists of two basic parts; a header and a body.    &lt;br /&gt;
The header describes the data being transmitted and the body holds the data being transmitted.
&lt;/p&gt;
&lt;p&gt;
3) The tree most important message types are (as I see it); document messages, command messages, event messages. You can read more about this messages in the book &lt;a href="http://www.amazon.com/Enterprise-Integration-Patterns-MobiPocket-ebook/dp/B000OZ0N9E/ref=sr_1_2?ie=UTF8&amp;amp;s=books&amp;amp;qid=1262898693&amp;amp;sr=8-2-spell" target="_blank"&gt;Enterprise Integration Patterns: Designing, Building, and Deploring Messaging Solutions&lt;/a&gt; (I&amp;rsquo;m linking to the kindle edition. I love my Kindle :-) ). 
&lt;/p&gt;
&lt;p&gt;
A bit more about this message types: A command message is a regular message that contains a command. It uses the command pattern to, for example, encapsulate the request and send it to another system. A document message is used to transferee a data structure between applications and a event message is used to notify another system about a change; for example a price change.
&lt;/p&gt;
&lt;p&gt;
4) When working with messages, you need a way to handle them. On the .NET platform there are several open source choices; NServicebus, Rhino Servicebus, Simple Servicebus and MassTransitt (it&amp;rsquo;s probably more solutions out there). I think all of them uses MSMQ when communicating the messages, but there are other ways too. There are probably some commercial products out there too, but I haven&amp;rsquo;t tried to look them up at the moment. For the record; you don&amp;rsquo;t need a enterprise service bus handle messages. A message can be used to communicate internal in an application, for example between bounded contexts.
&lt;/p&gt;
&lt;p&gt;
5) Messages are immutable. You can look at them as value objects. Greg Young puts it like this; &lt;strong&gt;Mutable messages are an anti-pattern&lt;/strong&gt;. You can read more about his at &lt;a href="http://codebetter.com/blogs/gregyoung/archive/2008/04/14/dddd-4-messages-are-value-objects.aspx" target="_blank"&gt;Greg Youngs blog&lt;/a&gt;.
&lt;/p&gt;
</description>
      <link>http://blog.fossmo.net/post/Five-things-to-think-about-when-working-with-messaging-solutions.aspx</link>
      <author>fossmo.nospam@nospam.fossmo.net (fossmo)</author>
      <comments>http://blog.fossmo.net/post/Five-things-to-think-about-when-working-with-messaging-solutions.aspx#comment</comments>
      <guid>http://blog.fossmo.net/post.aspx?id=e15dcef8-f2f9-4955-a634-807aab7412b6</guid>
      <pubDate>Thu, 07 Jan 2010 16:21:00 -0400</pubDate>
      <category>DDD</category>
      <category>Patterns</category>
      <category>Messages</category>
      <dc:publisher>fossmo</dc:publisher>
      <pingback:server>http://blog.fossmo.net/pingback.axd</pingback:server>
      <pingback:target>http://blog.fossmo.net/post.aspx?id=e15dcef8-f2f9-4955-a634-807aab7412b6</pingback:target>
      <slash:comments>0</slash:comments>
      <trackback:ping>http://blog.fossmo.net/trackback.axd?id=e15dcef8-f2f9-4955-a634-807aab7412b6</trackback:ping>
      <wfw:comment>http://blog.fossmo.net/post/Five-things-to-think-about-when-working-with-messaging-solutions.aspx#comment</wfw:comment>
      <wfw:commentRss>http://blog.fossmo.net/syndication.axd?post=e15dcef8-f2f9-4955-a634-807aab7412b6</wfw:commentRss>
    </item>
    <item>
      <title>Update to the CQRS figure</title>
      <description>&lt;p&gt;I did an update to the figure showing how I have implement the CQRS architecture.&amp;#160; As you can see from the figure, I have added a “message-pipeline” from the application service to the denormalizer. The reason is to show that all the updates to the read databases goes through this “pipeline”. The messages will for example be added to a queue or bus. The read databases then will pick up the new messages from the queue or bus, and update itself. I have left the synchronization arrow in the figure because it is used to initialize the read databases based on the write database. I have also done a update on how I have named the different layers and tires in the figure.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blog.fossmo.net/image.axd?picture=WindowsLiveWriter/UpdatetotheCQRSfigure/4FE2C0DA/image.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blog.fossmo.net/image.axd?picture=WindowsLiveWriter/UpdatetotheCQRSfigure/088D6AE8/image_thumb.png" width="489" height="367" /&gt;&lt;/a&gt;&lt;/p&gt;</description>
      <link>http://blog.fossmo.net/post/Update-to-the-CQRS-figure.aspx</link>
      <author>fossmo.nospam@nospam.fossmo.net (fossmo)</author>
      <comments>http://blog.fossmo.net/post/Update-to-the-CQRS-figure.aspx#comment</comments>
      <guid>http://blog.fossmo.net/post.aspx?id=601255ee-92ab-4953-886e-88a8736a77ae</guid>
      <pubDate>Tue, 08 Dec 2009 16:33:44 -0400</pubDate>
      <category>DDD</category>
      <category>CQRS</category>
      <dc:publisher>fossmo</dc:publisher>
      <pingback:server>http://blog.fossmo.net/pingback.axd</pingback:server>
      <pingback:target>http://blog.fossmo.net/post.aspx?id=601255ee-92ab-4953-886e-88a8736a77ae</pingback:target>
      <slash:comments>6</slash:comments>
      <trackback:ping>http://blog.fossmo.net/trackback.axd?id=601255ee-92ab-4953-886e-88a8736a77ae</trackback:ping>
      <wfw:comment>http://blog.fossmo.net/post/Update-to-the-CQRS-figure.aspx#comment</wfw:comment>
      <wfw:commentRss>http://blog.fossmo.net/syndication.axd?post=601255ee-92ab-4953-886e-88a8736a77ae</wfw:commentRss>
    </item>
    <item>
      <title>Command and Query Responsibility Segregation (CQRS)</title>
      <description>&lt;p&gt;
It&amp;rsquo;s almost one year since I read the &amp;ldquo;&lt;a href="http://www.amazon.com/Domain-Driven-Design-Tackling-Complexity-Software/dp/0321125215/ref=sr_1_1?ie=UTF8&amp;amp;s=books&amp;amp;qid=1258662121&amp;amp;sr=8-1" target="_blank"&gt;blue book&lt;/a&gt;&amp;rdquo;. It changed my view on how I write software and how I build software architecture. During my time as a software developer, I have tried many different approaches on building software. A lot of the approaches includes an anemic domain model. It&amp;rsquo;s nothing wrong with building an &lt;a href="http://en.wikipedia.org/wiki/Anemic_Domain_Model" target="_blank"&gt;anemic domain model&lt;/a&gt;, but for applications with a bit more complex business logic, it might not be the best choice. You can end up with a lot of &amp;ldquo;spaghetti code&amp;rdquo; with high coupling between the different parts of the code. &lt;a href="http://en.wikipedia.org/wiki/Anemic_Domain_Model" target="_blank"&gt;Anemic domain models&lt;/a&gt; have their business logic spread &amp;ldquo;all over&amp;rdquo; the code and you often have to do updates multiple places in your code if a business rule is changed. And you want to avoid that. Keep this in mind when you code:     &lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;&lt;em&gt;&amp;ldquo;Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live&amp;rdquo;&lt;/em&gt; &amp;ndash; M. Golding&lt;/strong&gt;     &lt;br /&gt;
&lt;br /&gt;
A classis &lt;a href="http://en.wikipedia.org/wiki/Domain_model" target="_blank"&gt;rich domain model&lt;/a&gt; holds all the business logic inside the model and most of the objects are connected to eachother. It strives to be a model that solves the domain logic for the business in one perfect model. And this is often where this way of writing software fails. You get a big model that finally gets very unwieldy. You should rather think bounded context, but that&amp;rsquo;s not the topic for this post.
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Split the model&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://blog.fossmo.net/image.axd?picture=WindowsLiveWriter/CQRStotherescue/6B675B45/pie.png"&gt;&lt;img style="border-width: 0px; margin: 0px 10px 0px 0px; display: inline" src="http://blog.fossmo.net/image.axd?picture=WindowsLiveWriter/CQRStotherescue/7939A140/pie_thumb.png" border="0" alt="pie" title="pie" width="83" height="83" align="left" /&gt;&lt;/a&gt; Instead of trying to solve everything in one model; split it into smaller parts and work with each part on its own. Create aggregates that naturally fits together. An example can be a car and a customer. In this example, both are aggregate roots. You should consider to not model both objects and their aggregates into one model. Think of them as small separated models inside the model. This will make the model much easier to handle when persisting and loading into memory. 
&lt;/p&gt;
&lt;p&gt;
Greg Young had a great example when he was explaining aggregate roots and how they should work. If a teacher is asked by the headmaster for a overview of his students, he will not bring all the students to the the headmasters office, but he will bring a list with the student information the headmaster wants. For the most part, there are no good arguments for putting everything in one big connected model.
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;The problem with relational databases&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
Nowadays many use ORM frameworks to persist data from the domain model to the database, and they use a relational database as the database (are there others? ;-)). A problem with the relation databases is that you have to do a compromise on speed regarding reading and writing data.&lt;strike&gt; If you normalize the database, it will be better at inserting, updating and deleting data, but not reading data. The problem are indexes. These buggers will in most cases slow down your select operations but help insert, delete and update operations.&lt;/strike&gt; 
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;&lt;strong&gt;Update:&lt;/strong&gt; I have received some comments on this statement. What I 
was trying to say is: If you add indexes to improve&amp;nbsp;update/delete operations, it 
might affect the selects you do against the database. You have to do a 
compromise; either you read faster or write faster. 
&lt;/p&gt;
&lt;p&gt;
If you decide to make the database better at reading data (selecting), one option is to de-normalize the database. A de-normalized database means tables with repetitive data and possibly tables with a number of columns from hell. 
&lt;/p&gt;
&lt;p&gt;
As developers we often don&amp;rsquo;t give much thought to this question; how to scale the solution? I think we should keep this thought in the front of your head when you create a solution that may have to serve a lot of users. I&amp;rsquo;m not saying you should try to predict the future, but with some simple measures from the start, you do not have to think much of it later.
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Command and Query Responsibility Segregation&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
Most applications reads data more frequently than they write data. Based on that statement, it would be a good idea to make a solution where easily you can add more databases to read from, right? So what if we set up a database dedicated just for reading? Even better; what if we design the database in a way so it&amp;rsquo;s faster to read from it? If you design your applications based on the patterns described in CQRS architecture, you will have a solution that is scalable and fast at reading data. Command Query Separation (CQS) is a pattern that was first thought of by Bertrand Meyer. He described it on the object level. Later this pattern has been lifted from the lower levels and has been used in the higher architectural level. I think it was Udi Dahan who first started talking about this architectural principle. 
&lt;/p&gt;
&lt;p&gt;
In this post I describe an architecture that is quite close to the one Udi is talking about. There are several implementations of this pattern, and one of them is described by Greg Young. Greg Young&amp;#39;s flavor of the pattern describes CQRS and Event Sourcing. I won&amp;rsquo;t go into this flavor in this post. If you want to learn more about this flavor, Google for it.
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;A quick walkthrough of the CQRS architecture&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
A graphical overview of the architecture is shown in the figure below. Lets do a quick walkthrough of the figure. A user opens an application and the first screen is loaded. The data is fetched from the Query side. In this example it goes through a WCF service and uses, lets say &lt;a href="https://www.hibernate.org/" target="_blank"&gt;NHibernate&lt;/a&gt;, to read data from the database and into a &lt;a href="http://en.wikipedia.org/wiki/Data_transfer_object" target="_blank"&gt;DTO&lt;/a&gt; that returns the data to the GUI. &lt;em&gt;The &lt;/em&gt;&lt;a href="http://en.wikipedia.org/wiki/Data_transfer_object" target="_blank"&gt;&lt;em&gt;DTO&lt;/em&gt;&lt;/a&gt;&lt;em&gt; is tailored to fit the screen the user is viewing.&lt;/em&gt; The query database is often &lt;a href="http://en.wikipedia.org/wiki/Denormalization" target="_blank"&gt;de-normalized&lt;/a&gt; to improve reading. The user may brows through different screens, and the process is the same. A &lt;a href="http://en.wikipedia.org/wiki/Data_transfer_object" target="_blank"&gt;DTO&lt;/a&gt; tailored for the users screen is returned from the database. Eventually, the user wants to change the data in one of the screens. What then happens is that a command message is created based on the data that have changed in the view and sent down the left side of the figure; the command side. The command message is sent into the domain model to get validated against the business rules. A error message is sent back to the client if some of the business rules fails (how this is done can differ). If the message goes through the domain model without errors, it&amp;rsquo;s persisted to the write database and synchronized with the read database(s). The command side should never return other data than the error message. If you follow this rule, the command side will only be behavioral. This makes logging of what happens in the domain model very easy, and it&amp;rsquo;s quite easy to track what the user wanted to do, not only what the result of his actions were. The approach I&amp;rsquo;m describing in this post is a bit different than Greg Young describes. His solution promotes no database on the command side; a database is only needed for reporting. This is a great approach, but it makes things a bit more complex and it requires a green field project(?). The approach I&amp;rsquo;m describing can be used with a brown field application without much change to the existing architecture. In most cases you only have to add a query-side to the &amp;ldquo;old&amp;rdquo; architecture.
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Why add query side DTOs?&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
In a traditional domain model, you will create the objects for solving domain logic, not for viewing. They have behavior rather than shape. To make domain objects more viewable, many developers use mapping between the domain model and a DTOs tailored for being displayed. This results in a lot of mapping between objects for the developer and domain models who exposes getters and setters (To learn why this is bad, do a Google search on; getters and setters are evil). 
&lt;/p&gt;
&lt;p&gt;
If you are using a ORM like NHibernate, you have to add getters to the domain model (and make the properties and methods virtual if you want to use lazy loading), and I think this is ok. The model is still protected against unwanted changes that can make it invalid. Every change have to happen through its command methods. 
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Summary&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
What you get from this architecture is; scalability on the read side of the application (where you normally get most load), the possibility to log all happenings in the domain model (by tracking the commands and events in the domain model), and a domain model that only have to worry about writing data, not be a transporter of data from the database to the GUI. I guarantee that this alone will make things a lot easier for you. And one final thing; creating objects (DTOs) based on the view helps us avoid a lot of mapping and a lot of requests against the database to fill the view with data. I will go through the parts of the architecture in more details in future posts.
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Update&lt;/strong&gt;: I have done a update to this figure in a new &lt;a href="http://blog.fossmo.net/post/Update-to-the-CQRS-figure.aspx"&gt;post&lt;/a&gt;. 
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://blog.fossmo.net/image.axd?picture=WindowsLiveWriter/CQRStotherescue/7D43EF12/image.png"&gt;&lt;img style="border-width: 0px; display: inline" src="http://blog.fossmo.net/image.axd?picture=WindowsLiveWriter/CQRStotherescue/390387C6/image_thumb.png" border="0" alt="image" title="image" width="641" height="484" /&gt;&lt;/a&gt;
&lt;/p&gt;
</description>
      <link>http://blog.fossmo.net/post/Command-and-Query-Responsibility-Segregation-(CQRS).aspx</link>
      <author>fossmo.nospam@nospam.fossmo.net (fossmo)</author>
      <comments>http://blog.fossmo.net/post/Command-and-Query-Responsibility-Segregation-(CQRS).aspx#comment</comments>
      <guid>http://blog.fossmo.net/post.aspx?id=d6e448d5-3dd9-4acf-ae5c-a92a0f296811</guid>
      <pubDate>Mon, 23 Nov 2009 16:29:00 -0400</pubDate>
      <category>DDD</category>
      <category>DND</category>
      <category>CQRS</category>
      <dc:publisher>fossmo</dc:publisher>
      <pingback:server>http://blog.fossmo.net/pingback.axd</pingback:server>
      <pingback:target>http://blog.fossmo.net/post.aspx?id=d6e448d5-3dd9-4acf-ae5c-a92a0f296811</pingback:target>
      <slash:comments>2</slash:comments>
      <trackback:ping>http://blog.fossmo.net/trackback.axd?id=d6e448d5-3dd9-4acf-ae5c-a92a0f296811</trackback:ping>
      <wfw:comment>http://blog.fossmo.net/post/Command-and-Query-Responsibility-Segregation-(CQRS).aspx#comment</wfw:comment>
      <wfw:commentRss>http://blog.fossmo.net/syndication.axd?post=d6e448d5-3dd9-4acf-ae5c-a92a0f296811</wfw:commentRss>
    </item>
    <item>
      <title>Note to self</title>
      <description>&lt;p&gt;Remember to use a &lt;strong&gt;property&lt;/strong&gt; when data binding in Windows Presentation Foundation. If you don’t remember this, you will spend at least one hour scratching your head wondering why the data won’t show up in your list box and swearing at Visual Studio 2010. But, it’s not studios fault, it’s yours!&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;This is wrong (field):&lt;/strong&gt;&lt;/p&gt;  &lt;pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt; List&amp;lt;&lt;span style="color: #0000ff"&gt;string&lt;/span&gt;&amp;gt; MyProperty;&lt;/pre&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/pre&gt;

&lt;p&gt;&lt;strong&gt;This is correct (property):&lt;/strong&gt; &lt;/p&gt;

&lt;pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;&lt;span style="color: #0000ff"&gt;private&lt;/span&gt; List&amp;lt;&lt;span style="color: #0000ff"&gt;string&lt;/span&gt;&amp;gt; _myProperty;
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt; List&amp;lt;&lt;span style="color: #0000ff"&gt;string&lt;/span&gt;&amp;gt; MyProperty 
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;{ 
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;   &lt;span style="color: #0000ff"&gt;get&lt;/span&gt; { &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; _myProperty; } 
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;   &lt;span style="color: #0000ff"&gt;set&lt;/span&gt; { _myProperty = &lt;span style="color: #0000ff"&gt;value&lt;/span&gt;; } 
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 12px"&gt;}&lt;/pre&gt;&lt;/pre&gt;

&lt;p&gt;I will never do this again!&lt;/p&gt;</description>
      <link>http://blog.fossmo.net/post/Note-to-self.aspx</link>
      <author>fossmo.nospam@nospam.fossmo.net (fossmo)</author>
      <comments>http://blog.fossmo.net/post/Note-to-self.aspx#comment</comments>
      <guid>http://blog.fossmo.net/post.aspx?id=0d96f3a2-5b3c-4b67-9ae2-680265665eb1</guid>
      <pubDate>Mon, 26 Oct 2009 13:17:07 -0400</pubDate>
      <dc:publisher>fossmo</dc:publisher>
      <pingback:server>http://blog.fossmo.net/pingback.axd</pingback:server>
      <pingback:target>http://blog.fossmo.net/post.aspx?id=0d96f3a2-5b3c-4b67-9ae2-680265665eb1</pingback:target>
      <slash:comments>0</slash:comments>
      <trackback:ping>http://blog.fossmo.net/trackback.axd?id=0d96f3a2-5b3c-4b67-9ae2-680265665eb1</trackback:ping>
      <wfw:comment>http://blog.fossmo.net/post/Note-to-self.aspx#comment</wfw:comment>
      <wfw:commentRss>http://blog.fossmo.net/syndication.axd?post=0d96f3a2-5b3c-4b67-9ae2-680265665eb1</wfw:commentRss>
    </item>
    <item>
      <title>Services</title>
      <description>&lt;p&gt;When starting to learn &lt;a href="http://www.domaindrivendesign.org/" target="_blank"&gt;Domain Driven Design&lt;/a&gt;, entities and values objects are things people normally understand pretty quickly. But, when it comes to services, I feel things are a bit more unclear for many. If you ask a Domain Driven Design expert about services, you probably will get the answer; &lt;em&gt;a service is something you can’t find a good place for in your domain model&lt;/em&gt;.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;A concrete example&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blog.fossmo.net/image.axd?picture=WindowsLiveWriter/6572f43c7d08_412/image_2.png"&gt;&lt;img style="border-right-width: 0px; margin: 0px 10px 0px 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" align="left" src="http://blog.fossmo.net/image.axd?picture=WindowsLiveWriter/6572f43c7d08_412/image_thumb.png" width="244" height="186" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;In almost every modern GUIs you use combo boxes as a way to display different choices for the user. You need a way to fill these boxes (look at the figure), but the action where you fill them doesn’t fit into your domain model in a natural way. I look at this as a service, something you need in your domain, but nothing you will force into your domain objects. In the applications I have created lately, I have often used value objects to transfer the data from the repository to the GUI through a service (follow the red arrows in the figure). You can of course create dedicated objects for this (follow the orange arrows in the figure), but I haven’t found the need for this yet.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blog.fossmo.net/image.axd?picture=WindowsLiveWriter/6572f43c7d08_412/image_2.png"&gt;&amp;#160;&lt;/a&gt;&lt;/p&gt;</description>
      <link>http://blog.fossmo.net/post/Services.aspx</link>
      <author>fossmo.nospam@nospam.fossmo.net (admin)</author>
      <comments>http://blog.fossmo.net/post/Services.aspx#comment</comments>
      <guid>http://blog.fossmo.net/post.aspx?id=dfff822f-74df-49d3-8b0c-2acd4f9cf443</guid>
      <pubDate>Sun, 30 Aug 2009 17:24:03 -0400</pubDate>
      <category>DDD</category>
      <dc:publisher>admin</dc:publisher>
      <pingback:server>http://blog.fossmo.net/pingback.axd</pingback:server>
      <pingback:target>http://blog.fossmo.net/post.aspx?id=dfff822f-74df-49d3-8b0c-2acd4f9cf443</pingback:target>
      <slash:comments>0</slash:comments>
      <trackback:ping>http://blog.fossmo.net/trackback.axd?id=dfff822f-74df-49d3-8b0c-2acd4f9cf443</trackback:ping>
      <wfw:comment>http://blog.fossmo.net/post/Services.aspx#comment</wfw:comment>
      <wfw:commentRss>http://blog.fossmo.net/syndication.axd?post=dfff822f-74df-49d3-8b0c-2acd4f9cf443</wfw:commentRss>
    </item>
    <item>
      <title>How to set the windows position in WPF</title>
      <description>&lt;p&gt;To position a window manually on the screen in Window Presentation Foundation you can use these system properties &lt;strong&gt;Window.Left&lt;/strong&gt; and &lt;strong&gt;Window.Top&lt;/strong&gt;. To get the size of the screen you can use these system properties:&lt;/p&gt;  &lt;pre&gt;System.Windows.SystemParameters.PrimaryScreenWidth;
System.Windows.SystemParameters.PrimaryScreenHeight;&lt;/pre&gt;

&lt;p&gt;To set a window (the green one) position like the one shown at the image below, you can use this method:&lt;/p&gt;

&lt;div&gt;
  &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #0000ff"&gt;private&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; SetWindowPosition()
{
    Left = SystemParameters.PrimaryScreenWidth - (&lt;span style="color: #0000ff"&gt;double&lt;/span&gt;)GetValue(WidthProperty) - 30; ;
    Top = 150;
}&lt;/pre&gt;
&lt;/div&gt;
&lt;font face="Courier New"&gt;&lt;/font&gt;

&lt;p&gt;&lt;a href="http://blog.fossmo.net/image.axd?picture=WindowsLiveWriter/42c9592f3e8f/1A3E4FC0/image.png"&gt;&lt;img title="image" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="271" alt="image" src="http://blog.fossmo.net/image.axd?picture=WindowsLiveWriter/42c9592f3e8f/281095BB/image_thumb.png" width="644" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;</description>
      <link>http://blog.fossmo.net/post/How-to-set-the-windows-position-in-WPF.aspx</link>
      <author>fossmo.nospam@nospam.fossmo.net (fossmo)</author>
      <comments>http://blog.fossmo.net/post/How-to-set-the-windows-position-in-WPF.aspx#comment</comments>
      <guid>http://blog.fossmo.net/post.aspx?id=71f0e2e6-220e-440a-a958-b7715cdfe9f6</guid>
      <pubDate>Wed, 29 Jul 2009 17:18:16 -0400</pubDate>
      <category>WPF</category>
      <category>C#</category>
      <dc:publisher>fossmo</dc:publisher>
      <pingback:server>http://blog.fossmo.net/pingback.axd</pingback:server>
      <pingback:target>http://blog.fossmo.net/post.aspx?id=71f0e2e6-220e-440a-a958-b7715cdfe9f6</pingback:target>
      <slash:comments>0</slash:comments>
      <trackback:ping>http://blog.fossmo.net/trackback.axd?id=71f0e2e6-220e-440a-a958-b7715cdfe9f6</trackback:ping>
      <wfw:comment>http://blog.fossmo.net/post/How-to-set-the-windows-position-in-WPF.aspx#comment</wfw:comment>
      <wfw:commentRss>http://blog.fossmo.net/syndication.axd?post=71f0e2e6-220e-440a-a958-b7715cdfe9f6</wfw:commentRss>
    </item>
  </channel>
</rss>