<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/" version="2.0">
  <channel>
    <title>Felice Pollano Blog</title>
    <link>http://www.felicepollano.com/</link>
    <description>The official Fatica Labs Blog!</description>
    <language>en-us</language>
    <copyright>Felice Pollano</copyright>
    <lastBuildDate>Fri, 15 Feb 2013 19:12:15 GMT</lastBuildDate>
    <generator>newtelligence dasBlog 2.3.9074.18820</generator>
    <managingEditor>felice@felicepollano.com</managingEditor>
    <webMaster>felice@felicepollano.com</webMaster>
    <item>
      <trackback:ping>http://www.felicepollano.com/Trackback.aspx?guid=4e1b2ef9-52bc-47d7-952c-b03c3de451cd</trackback:ping>
      <pingback:server>http://www.felicepollano.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.felicepollano.com/PermaLink.aspx?guid=4e1b2ef9-52bc-47d7-952c-b03c3de451cd</pingback:target>
      <dc:creator>Felice Pollano</dc:creator>
      <wfw:comment>http://www.felicepollano.com/CommentView.aspx?guid=4e1b2ef9-52bc-47d7-952c-b03c3de451cd</wfw:comment>
      <wfw:commentRss>http://www.felicepollano.com/SyndicationService.asmx/GetEntryCommentsRss?guid=4e1b2ef9-52bc-47d7-952c-b03c3de451cd</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p align="justify">
In the <a href="http://www.felicepollano.com/2013/02/12/PlayingWithZeroMQPUBSUB.aspx" target="_blank">last
post</a> I shown a Publish/Subscribe communication pattern with <a href="http://www.zeromq.org/" target="_blank">ZeroMQ</a> and
its <a href="https://github.com/zeromq/clrzmq" target="_blank">C# binding library</a> showing
an asynchronous way in dispatching messages through many clients. Well this is not
the only way we have. Another strategy is to have a listener and many clients sending
messages to it and awaiting for response. All this is achieved by changing the Socket
type we create.
</p>
        <p align="justify">
You can find <a href="https://bitbucket.org/Felice_Pollano/test0mq" target="_blank">the
code for this example and the previous one here</a>.
</p>
        <p align="justify">
 
</p>
        <p align="justify">
Here the code for the client:
</p>
        <p align="justify">
          <a href="http://www.felicepollano.com/public/WindowsLiveWriter/PlayingwithZeroMQREQREP_11B9A/image_2.png">
            <img title="image" style="border-top: 0px; border-right: 0px; border-bottom: 0px; border-left: 0px; display: inline" border="0" alt="image" src="http://www.felicepollano.com/public/WindowsLiveWriter/PlayingwithZeroMQREQREP_11B9A/image_thumb.png" width="460" height="444" />
          </a>
        </p>
        <p>
After the connect, we start a loop sending a message to the server, and receiving
the reply from it.
</p>
        <p>
Here is the server:
</p>
        <p>
          <a href="http://www.felicepollano.com/public/WindowsLiveWriter/PlayingwithZeroMQREQREP_11B9A/image_4.png">
            <img title="image" style="border-top: 0px; border-right: 0px; border-bottom: 0px; border-left: 0px; display: inline" border="0" alt="image" src="http://www.felicepollano.com/public/WindowsLiveWriter/PlayingwithZeroMQREQREP_11B9A/image_thumb_1.png" width="772" height="570" />
          </a>
        </p>
        <p>
Please note the Bind() function, this is the line saying server is listening for calls.
Code contains a test, proving messages are handled in sequence even if many client
are sending messages in concurrency. This is part of the key point of this communication
pattern:
</p>
        <p>
 
</p>
        <p>
          <strong>Request/Reply key Point</strong>:
</p>
        <ul>
          <li>
Client pass without error the Connect call, <strong>even if the server is not yet
listening.</strong></li>
          <li>
The client send call is <strong>never blocking</strong>.</li>
          <li>
The client<strong><u>Receive() blocks until server reply</u></strong>.</li>
          <li>
It<strong> is not possible to Send</strong> another message <strong>if no reply from
server is received</strong>.</li>
          <li>
            <strong>Server</strong> is guarantee to <strong>process one request at a time</strong> (
queue )</li>
        </ul>
        <p>
So there is a sort of state on the cannel, and we have some feedback about the fact
the recipient handle our messages. If you heard about the <a href="http://kellabyte.com/2012/05/30/clarifying-the-saga-pattern/" target="_blank">Saga</a> pattern
you probably guess when this scenario can be used. 
</p>
        <img width="0" height="0" src="http://www.felicepollano.com/aggbug.ashx?id=4e1b2ef9-52bc-47d7-952c-b03c3de451cd" />
      </body>
      <title>Playing with ZeroMQ REQ-REP</title>
      <guid isPermaLink="false">http://www.felicepollano.com/PermaLink.aspx?guid=4e1b2ef9-52bc-47d7-952c-b03c3de451cd</guid>
      <link>http://www.felicepollano.com/2013/02/15/PlayingWithZeroMQREQREP.aspx</link>
      <pubDate>Fri, 15 Feb 2013 19:12:15 GMT</pubDate>
      <description>&lt;p align="justify"&gt;
In the &lt;a href="http://www.felicepollano.com/2013/02/12/PlayingWithZeroMQPUBSUB.aspx" target="_blank"&gt;last
post&lt;/a&gt; I shown a Publish/Subscribe communication pattern with &lt;a href="http://www.zeromq.org/" target="_blank"&gt;ZeroMQ&lt;/a&gt; and
its &lt;a href="https://github.com/zeromq/clrzmq" target="_blank"&gt;C# binding library&lt;/a&gt; showing
an asynchronous way in dispatching messages through many clients. Well this is not
the only way we have. Another strategy is to have a listener and many clients sending
messages to it and awaiting for response. All this is achieved by changing the Socket
type we create.
&lt;/p&gt;
&lt;p align="justify"&gt;
You can find &lt;a href="https://bitbucket.org/Felice_Pollano/test0mq" target="_blank"&gt;the
code for this example and the previous one here&lt;/a&gt;.
&lt;/p&gt;
&lt;p align="justify"&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p align="justify"&gt;
Here the code for the client:
&lt;/p&gt;
&lt;p align="justify"&gt;
&lt;a href="http://www.felicepollano.com/public/WindowsLiveWriter/PlayingwithZeroMQREQREP_11B9A/image_2.png"&gt;&lt;img title="image" style="border-top: 0px; border-right: 0px; border-bottom: 0px; border-left: 0px; display: inline" border="0" alt="image" src="http://www.felicepollano.com/public/WindowsLiveWriter/PlayingwithZeroMQREQREP_11B9A/image_thumb.png" width="460" height="444"&gt;&lt;/a&gt; 
&lt;/p&gt;
&lt;p&gt;
After the connect, we start a loop sending a message to the server, and receiving
the reply from it.
&lt;/p&gt;
&lt;p&gt;
Here is the server:
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://www.felicepollano.com/public/WindowsLiveWriter/PlayingwithZeroMQREQREP_11B9A/image_4.png"&gt;&lt;img title="image" style="border-top: 0px; border-right: 0px; border-bottom: 0px; border-left: 0px; display: inline" border="0" alt="image" src="http://www.felicepollano.com/public/WindowsLiveWriter/PlayingwithZeroMQREQREP_11B9A/image_thumb_1.png" width="772" height="570"&gt;&lt;/a&gt; 
&lt;/p&gt;
&lt;p&gt;
Please note the Bind() function, this is the line saying server is listening for calls.
Code contains a test, proving messages are handled in sequence even if many client
are sending messages in concurrency. This is part of the key point of this communication
pattern:
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Request/Reply key Point&lt;/strong&gt;:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
Client pass without error the Connect call, &lt;strong&gt;even if the server is not yet
listening.&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;
The client send call is &lt;strong&gt;never blocking&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;
The client&lt;strong&gt; &lt;u&gt;Receive() blocks until server reply&lt;/u&gt;&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;
It&lt;strong&gt; is not possible to Send&lt;/strong&gt; another message &lt;strong&gt;if no reply from
server is received&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Server&lt;/strong&gt; is guarantee to &lt;strong&gt;process one request at a time&lt;/strong&gt; (
queue )&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
So there is a sort of state on the cannel, and we have some feedback about the fact
the recipient handle our messages. If you heard about the &lt;a href="http://kellabyte.com/2012/05/30/clarifying-the-saga-pattern/" target="_blank"&gt;Saga&lt;/a&gt; pattern
you probably guess when this scenario can be used. 
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.felicepollano.com/aggbug.ashx?id=4e1b2ef9-52bc-47d7-952c-b03c3de451cd" /&gt;</description>
      <comments>http://www.felicepollano.com/CommentView.aspx?guid=4e1b2ef9-52bc-47d7-952c-b03c3de451cd</comments>
      <category>C#</category>
      <category>communication</category>
      <category>ZeroMQ</category>
    </item>
    <item>
      <trackback:ping>http://www.felicepollano.com/Trackback.aspx?guid=5f182c79-7f55-44df-9259-ddebe71c3707</trackback:ping>
      <pingback:server>http://www.felicepollano.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.felicepollano.com/PermaLink.aspx?guid=5f182c79-7f55-44df-9259-ddebe71c3707</pingback:target>
      <dc:creator>Felice Pollano</dc:creator>
      <wfw:comment>http://www.felicepollano.com/CommentView.aspx?guid=5f182c79-7f55-44df-9259-ddebe71c3707</wfw:comment>
      <wfw:commentRss>http://www.felicepollano.com/SyndicationService.asmx/GetEntryCommentsRss?guid=5f182c79-7f55-44df-9259-ddebe71c3707</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p align="justify">
          <a href="http://www.zeromq.org/" target="_blank">Zero MQ</a> is a server less message
queuing facility that does not require any additional services to work ( ie no MSMQ
needing ). I show here an example in how to use that library from C# by creating a
small pub subscribe scenario. Just to clarify is a scenario having a publisher sending
some messages and <strong>one or more</strong> subscriber that will be notified of
that message. 
</p>
        <p align="justify">
          <a href="https://bitbucket.org/Felice_Pollano/test0mq" target="_blank">You can find
all the source code for this example here</a>.
</p>
        <p align="justify">
 
</p>
        <p align="justify">
In order to get started, we need a wrapper callable for .NET, since ZeroMQ exposes
a native interface. I did use <strong><a href="https://github.com/zeromq/clrzmq" target="_blank">clrzmq</a></strong> for
the purpose in my project, I did clone my version just to fix some bug in compiling
when there is spaces in subdir, so the actual version I use <a href="https://github.com/FelicePollano/clrzmq" target="_blank">is
here</a>.
</p>
        <p align="justify">
Then I <a href="http://www.zeromq.org/distro:microsoft-windows" target="_blank">download
the latest stable 3.2.2 RC 2</a> at the moment I’m writing and launched the setup.
The binary after the setup will contain something like this:
</p>
        <p align="justify">
          <a href="http://www.felicepollano.com/public/WindowsLiveWriter/PlayingwithZeroMQPUBSUB_DE1C/image_2.png">
            <img title="image" style="border-left-width: 0px; border-right-width: 0px; border-bottom-width: 0px; display: inline; border-top-width: 0px" border="0" alt="image" src="http://www.felicepollano.com/public/WindowsLiveWriter/PlayingwithZeroMQPUBSUB_DE1C/image_thumb.png" width="204" height="392" />
          </a>
        </p>
        <p align="justify">
Notice the naming containing the <strong>–vXXX</strong> subfix. this is the<strong> C++
Runtime Version the library is built against</strong>. Pick the correct one for your
system ( you must have a Visual C++ runtime installed )  and rename it as<strong> libzmq.dll, </strong>since
the wrapper expect the dll with this name. Alternatively you can download the wrapper
via nuget:
</p>
        <p align="justify">
          <strong>PM&gt; Install-Package clrzmq –Pre</strong>
        </p>
        <p align="justify">
          <a href="https://bitbucket.org/Felice_Pollano/test0mq" target="_blank">In order to
just see the example you can just checkout the example repository</a>.
</p>
        <p align="justify">
 
</p>
        <p align="justify">
The example is divided in two (console) application, a publisher and a receiver. Let’s
see the sender below:
</p>
        <p align="justify">
          <a href="http://www.felicepollano.com/public/WindowsLiveWriter/PlayingwithZeroMQPUBSUB_DE1C/image_6.png">
            <img title="image" style="border-left-width: 0px; border-right-width: 0px; border-bottom-width: 0px; display: inline; border-top-width: 0px" border="0" alt="image" src="http://www.felicepollano.com/public/WindowsLiveWriter/PlayingwithZeroMQPUBSUB_DE1C/image_thumb_2.png" width="434" height="413" />
          </a>
        </p>
        <p align="justify">
 
</p>
        <p align="justify">
Really simple, the key point are the<strong> SocketType.PUB</strong>, meaning we use
the socket to publish messages, and the <strong>Bind</strong> in which we decide an <strong>address</strong> and
a <strong>protocol</strong> where to listen for connections. Then we start sending
some rubbish on the created channel. Message are string, but eventually they are <strong>byte[].</strong> The
Send overload accepting a string is actually a wrapper additional bonus. 
</p>
        <p align="justify">
Notice that:
</p>
        <ul>
          <li>
            <div align="justify">
              <strong>No server is required</strong> in order to dispatch messages
</div>
          </li>
          <li>
            <div align="justify">
              <strong>Send is not blocking</strong>: independently if there
is subscriber or not, Send function exits immediately.
</div>
          </li>
        </ul>
        <p align="justify">
Let’s see the the subscriber:
</p>
        <p align="justify">
          <a href="http://www.felicepollano.com/public/WindowsLiveWriter/PlayingwithZeroMQPUBSUB_DE1C/image_8.png">
            <img title="image" style="border-left-width: 0px; border-right-width: 0px; border-bottom-width: 0px; display: inline; border-top-width: 0px" border="0" alt="image" src="http://www.felicepollano.com/public/WindowsLiveWriter/PlayingwithZeroMQPUBSUB_DE1C/image_thumb_3.png" width="446" height="422" />
          </a>
        </p>
        <p>
        </p>
        <p>
        </p>
        <p>
        </p>
        <p align="justify">
the key points here are the <strong>SocketType.SUB</strong>, the subscriber market,
the <strong>Connect</strong> that must match the publisher protocol/address, and the <strong>SubscribeAll</strong> (
there is a less eager <strong>Subscribe</strong> that allow to specify a filter for
the messages ). 
</p>
        <p align="justify">
Notice that:
</p>
        <ul>
          <li>
            <div align="justify">You <strong>can start/stop</strong> a subscriber <strong>at any
moment</strong>, it will be notified soon of the published messages
</div>
          </li>
          <li>
            <div align="justify">
              <strong>Messages are not queued</strong> at all.
</div>
          </li>
        </ul>
        <p align="justify">
Last point maybe is a little confusing if you expect something like MSMQ: there is
no messages buffer somewhere storing non consumed messages ( ie there is no Permanent
Subscriptions as in ActiveMQ ), if you want that feature you must implement it externally. 
</p>
        <p align="justify">
So, a great and simple library, having the simplicity,lightness  no service requirement
as a pro,<strike> but the drawback of needing the Visual C++ runtime</strike> and
the leak of a permanent subscription out of the box.
</p>
        <p>
          <strong>**UPDATE**</strong>
        </p>
        <p>
I had a chance to test the example codebase here on a Widow7 almost clean machine
( without any VisualStudio in ) and the solution works by <strong><u>XCOPY deploying</u></strong><strong>msvcr100.dll</strong> and <strong>msvcp100.dll</strong>,
included into the repository. Taths a great thing and it makes the 0 in the 0MQ being
an actual 0 :D
</p>
        <img width="0" height="0" src="http://www.felicepollano.com/aggbug.ashx?id=5f182c79-7f55-44df-9259-ddebe71c3707" />
      </body>
      <title>Playing with ZeroMQ PUB-SUB</title>
      <guid isPermaLink="false">http://www.felicepollano.com/PermaLink.aspx?guid=5f182c79-7f55-44df-9259-ddebe71c3707</guid>
      <link>http://www.felicepollano.com/2013/02/12/PlayingWithZeroMQPUBSUB.aspx</link>
      <pubDate>Tue, 12 Feb 2013 15:26:11 GMT</pubDate>
      <description>&lt;p align="justify"&gt;
&lt;a href="http://www.zeromq.org/" target="_blank"&gt;Zero MQ&lt;/a&gt; is a server less message
queuing facility that does not require any additional services to work ( ie no MSMQ
needing ). I show here an example in how to use that library from C# by creating a
small pub subscribe scenario. Just to clarify is a scenario having a publisher sending
some messages and &lt;strong&gt;one or more&lt;/strong&gt; subscriber that will be notified of
that message. 
&lt;/p&gt;
&lt;p align="justify"&gt;
&lt;a href="https://bitbucket.org/Felice_Pollano/test0mq" target="_blank"&gt;You can find
all the source code for this example here&lt;/a&gt;.
&lt;/p&gt;
&lt;p align="justify"&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p align="justify"&gt;
In order to get started, we need a wrapper callable for .NET, since ZeroMQ exposes
a native interface. I did use &lt;strong&gt;&lt;a href="https://github.com/zeromq/clrzmq" target="_blank"&gt;clrzmq&lt;/a&gt;&lt;/strong&gt; for
the purpose in my project, I did clone my version just to fix some bug in compiling
when there is spaces in subdir, so the actual version I use &lt;a href="https://github.com/FelicePollano/clrzmq" target="_blank"&gt;is
here&lt;/a&gt;.
&lt;/p&gt;
&lt;p align="justify"&gt;
Then I &lt;a href="http://www.zeromq.org/distro:microsoft-windows" target="_blank"&gt;download
the latest stable 3.2.2 RC 2&lt;/a&gt; at the moment I’m writing and launched the setup.
The binary after the setup will contain something like this:
&lt;/p&gt;
&lt;p align="justify"&gt;
&lt;a href="http://www.felicepollano.com/public/WindowsLiveWriter/PlayingwithZeroMQPUBSUB_DE1C/image_2.png"&gt;&lt;img title="image" style="border-left-width: 0px; border-right-width: 0px; border-bottom-width: 0px; display: inline; border-top-width: 0px" border="0" alt="image" src="http://www.felicepollano.com/public/WindowsLiveWriter/PlayingwithZeroMQPUBSUB_DE1C/image_thumb.png" width="204" height="392"&gt;&lt;/a&gt; 
&lt;/p&gt;
&lt;p align="justify"&gt;
Notice the naming containing the &lt;strong&gt;–vXXX&lt;/strong&gt; subfix. this is the&lt;strong&gt; C++
Runtime Version the library is built against&lt;/strong&gt;. Pick the correct one for your
system ( you must have a Visual C++ runtime installed )&amp;nbsp; and rename it as&lt;strong&gt; libzmq.dll, &lt;/strong&gt;since
the wrapper expect the dll with this name. Alternatively you can download the wrapper
via nuget:
&lt;/p&gt;
&lt;p align="justify"&gt;
&lt;strong&gt;PM&amp;gt; Install-Package clrzmq –Pre&lt;/strong&gt;
&lt;/p&gt;
&lt;p align="justify"&gt;
&lt;a href="https://bitbucket.org/Felice_Pollano/test0mq" target="_blank"&gt;In order to
just see the example you can just checkout the example repository&lt;/a&gt;.
&lt;/p&gt;
&lt;p align="justify"&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p align="justify"&gt;
The example is divided in two (console) application, a publisher and a receiver. Let’s
see the sender below:
&lt;/p&gt;
&lt;p align="justify"&gt;
&lt;a href="http://www.felicepollano.com/public/WindowsLiveWriter/PlayingwithZeroMQPUBSUB_DE1C/image_6.png"&gt;&lt;img title="image" style="border-left-width: 0px; border-right-width: 0px; border-bottom-width: 0px; display: inline; border-top-width: 0px" border="0" alt="image" src="http://www.felicepollano.com/public/WindowsLiveWriter/PlayingwithZeroMQPUBSUB_DE1C/image_thumb_2.png" width="434" height="413"&gt;&lt;/a&gt; 
&lt;/p&gt;
&lt;p align="justify"&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p align="justify"&gt;
Really simple, the key point are the&lt;strong&gt; SocketType.PUB&lt;/strong&gt;, meaning we use
the socket to publish messages, and the &lt;strong&gt;Bind&lt;/strong&gt; in which we decide an &lt;strong&gt;address&lt;/strong&gt; and
a &lt;strong&gt;protocol&lt;/strong&gt; where to listen for connections. Then we start sending
some rubbish on the created channel. Message are string, but eventually they are &lt;strong&gt;byte[].&lt;/strong&gt; The
Send overload accepting a string is actually a wrapper additional bonus. 
&lt;/p&gt;
&lt;p align="justify"&gt;
Notice that:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;div align="justify"&gt;&lt;strong&gt;No server is required&lt;/strong&gt; in order to dispatch messages
&lt;/div&gt;
&lt;li&gt;
&lt;div align="justify"&gt;&lt;strong&gt;Send is not blocking&lt;/strong&gt;: independently if there
is subscriber or not, Send function exits immediately.
&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p align="justify"&gt;
Let’s see the the subscriber:
&lt;/p&gt;
&lt;p align="justify"&gt;
&lt;a href="http://www.felicepollano.com/public/WindowsLiveWriter/PlayingwithZeroMQPUBSUB_DE1C/image_8.png"&gt;&lt;img title="image" style="border-left-width: 0px; border-right-width: 0px; border-bottom-width: 0px; display: inline; border-top-width: 0px" border="0" alt="image" src="http://www.felicepollano.com/public/WindowsLiveWriter/PlayingwithZeroMQPUBSUB_DE1C/image_thumb_3.png" width="446" height="422"&gt;&lt;/a&gt; 
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p align="justify"&gt;
the key points here are the &lt;strong&gt;SocketType.SUB&lt;/strong&gt;, the subscriber market,
the &lt;strong&gt;Connect&lt;/strong&gt; that must match the publisher protocol/address, and the &lt;strong&gt;SubscribeAll&lt;/strong&gt; (
there is a less eager &lt;strong&gt;Subscribe&lt;/strong&gt; that allow to specify a filter for
the messages ). 
&lt;/p&gt;
&lt;p align="justify"&gt;
Notice that:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;div align="justify"&gt;You &lt;strong&gt;can start/stop&lt;/strong&gt; a subscriber &lt;strong&gt;at any
moment&lt;/strong&gt;, it will be notified soon of the published messages
&lt;/div&gt;
&lt;li&gt;
&lt;div align="justify"&gt;&lt;strong&gt;Messages are not queued&lt;/strong&gt; at all.
&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p align="justify"&gt;
Last point maybe is a little confusing if you expect something like MSMQ: there is
no messages buffer somewhere storing non consumed messages ( ie there is no Permanent
Subscriptions as in ActiveMQ ), if you want that feature you must implement it externally. 
&lt;/p&gt;
&lt;p align="justify"&gt;
So, a great and simple library, having the simplicity,lightness&amp;nbsp; no service requirement
as a pro,&lt;strike&gt; but the drawback of needing the Visual C++ runtime&lt;/strike&gt; and
the leak of a permanent subscription out of the box.
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;**UPDATE**&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
I had a chance to test the example codebase here on a Widow7 almost clean machine
( without any VisualStudio in ) and the solution works by &lt;strong&gt;&lt;u&gt;XCOPY deploying&lt;/u&gt;&lt;/strong&gt; &lt;strong&gt;msvcr100.dll&lt;/strong&gt; and &lt;strong&gt;msvcp100.dll&lt;/strong&gt;,
included into the repository. Taths a great thing and it makes the 0 in the 0MQ being
an actual 0 :D
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.felicepollano.com/aggbug.ashx?id=5f182c79-7f55-44df-9259-ddebe71c3707" /&gt;</description>
      <comments>http://www.felicepollano.com/CommentView.aspx?guid=5f182c79-7f55-44df-9259-ddebe71c3707</comments>
      <category>C#</category>
      <category>communication</category>
      <category>ZeroMQ</category>
    </item>
    <item>
      <trackback:ping>http://www.felicepollano.com/Trackback.aspx?guid=d8e295cc-734b-41d7-ae94-29264822e7fd</trackback:ping>
      <pingback:server>http://www.felicepollano.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.felicepollano.com/PermaLink.aspx?guid=d8e295cc-734b-41d7-ae94-29264822e7fd</pingback:target>
      <dc:creator>Felice Pollano</dc:creator>
      <wfw:comment>http://www.felicepollano.com/CommentView.aspx?guid=d8e295cc-734b-41d7-ae94-29264822e7fd</wfw:comment>
      <wfw:commentRss>http://www.felicepollano.com/SyndicationService.asmx/GetEntryCommentsRss?guid=d8e295cc-734b-41d7-ae94-29264822e7fd</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p align="justify">
I’ve noticed that sometimes when developer want to embed in they own infrastructure
an external library they feel the needing of encapsulate that dependency in a common-versus-tool
library. So we have a plethora of, just for say CommonLogging, CommonIoC, CommonOrm
and so on, every one claiming the ability of “Just Plug The Tool”. 
</p>
        <p align="justify">
I would like to try to show why this is a tremendously ugly antipattern in my opinion,
by showing the side effects of this approach, and alternative solutions.
</p>
        <h2>
        </h2>
        <p align="justify">
        </p>
        <h4>1.CommonIoC or CommonServiceLocator (squared antipattern) 
</h4>
        <p align="justify">
The first impressive attempt is trying to insulate the IoC kernel we want to use.
So instead on having the application depending on the IoC, we just have the App depending
on the CommmonThing, we do some work in creating it, we have back nothing but a boring
piece of code to maintain. The spectacular attempt is when the encapsulated guy is
the service locator, that guy kill by its own the entire effort in code decoupling,
make component dependency obscure to everyone else but the developer who code the
component in the first week. So creating the common layer just multiply the side effects
and the result is a squared antipattern that scares any reasonable professional.
</p>
        <p align="justify">
The solution: In this case there is a pattern that is a real silver bullet : <a href="http://blog.ploeh.dk/2011/07/28/CompositionRoot.aspx" target="_blank">Composition
Root</a>. Just have the IoC used in a single point and have it’s effect propagating
trough all the application by using the proper IoC features: Inject into constructors,
use factories and have the IoC effect recursively propagate among all the application
without referring directly the kernel. In the root, use all the IoC features you have,
by not having the common thing around you, you have no lowest common denominator to
deal with. If you want to change the IoC in the future, you completely rewrite this
single file, and you will use all the new kernel features. You must avoid using byzantine
attributes for injecting your properties, if the IoC you mind to use need them, is
not the correct one. A side effect of this approach could be an increasing amount
of factories class. While this could be considered a problem some IoC offer some sort
of automatic factories, out of the box or with additional plugin. I’m not sure if
they help or not, i fear that code became too magic, and this will possibly violate
the “<a href="http://www.codinghorror.com/blog/2008/06/coding-for-violent-psychopaths.html" target="_blank">Coding
For a Violent Psycopaths</a>” principle. As a least consideration: IoC is for applications,
it is not for libraries. If you are writing an infrastructure reusable component,
you must not base it on any IoC strategy. Things are a little different if you are
creating a framework, and this framework leverages and offer services when an IoC
exist in the hosting application. Even in this case, instead of creating a common
thing, the framework should provide<strong> its own IoC abstraction,</strong> and
the hosting application must provide an adapter to the IoC currently used. The framework
abstraction must be designed in order to fully satisfy the framework requirements,
leaving the adapter implementer the challenge its own IoC. A good example of a framework
using the described strategy is <a href="http://caliburnmicro.codeplex.com/" target="_blank">Caliburn
Micro</a>.
</p>
        <p align="justify">
        </p>
        <h4>2.Common logging
</h4>
        <p align="justify">
Since every good appealing applications logs, this is a real temptation for the CommonLogging
beast. Even not considering the fact that the logging libraries used in production
are about two, why we need this? Please enumerate how many time you decide to drop
a logger in favour of another, end eve if this was the case, was really this refactoring
time jeopardizing the project? Another danger coming from the CommonBeast here is
the fact that being such a library “too small” to be justified, it can possibly collapse
in another anti pattern: “<em>The enterprise magic library</em>”, a library containing
a set of more or less useful thing that every developer want to maintain when new
stuff has to be added, and no one feel responsible when it breaks. 
</p>
        <p align="justify">
The solution: Is the same as above: define the logging interface in the library, and
let the application implement it. A great example on this comes form <a href="http://nhforge.org" target="_blank">NHibernate</a>.
NH was strictly bound with log4net till version 3.xxx, starting from there you can
implement its own abstract logging interface. Beautiful to have, NH uses log4net as
a default by dynamically loading it ( eliminating the needing of having log4net at
compile time ) degrading gracefully to the old behavior. 
</p>
        <h4>3.Common OR/M
</h4>
        <p align="justify">
This is probably the worst. An OR/m already introduce a sensible impedance toward
the database, adding an home made abstraction layer pretending to deal wit NH, EF
add another <strong>multiplying</strong> impedance to your application. Writing an
application that leverages an OR/M is usually a collection of best practices that
OR/M imposes to make the data access as faster as possible. Such trick are usually
difficult to abstract and you don’t know a lot of them until you face it.
</p>
        <p align="justify">
The solution: First solution is don’t do it at all. it is not a so strange scenario
to choose the or/m you want to use in the design phase, and bring it to production
and maintenance simply with that or/m. By the way software makes money when it does
what the customer want, not when is modified to follow the latest trend in data access.
Another less strict solution is to use the <em>“query object pattern”,</em> that does
not mean implement your ad hoc query provider, but means encapsulate each aggregates
operation in single classes responsible for all the data access, exposing proper and
useful methods to refine the query specialized for the aggregate. This allow a conceptually
easy refactoring if we want to change the OR/M. And by the way in an every day experience
scenario, you mostly don’t swap NH or EF, but more probably you want to change some
of your query object to use some micro OR/m for performance reason.
</p>
        <p align="justify">
        </p>
        <p align="justify">
The example series could be extended to the same degree of utility libraries we use.
A CommonMessaging the first one comes in mind.The point is that the “CommonThing”
is a worst practice, it gives us no advantages but just pain and problems, so use
all the effort to avoid it and focalize into the real problem.
</p>
        <img width="0" height="0" src="http://www.felicepollano.com/aggbug.ashx?id=d8e295cc-734b-41d7-ae94-29264822e7fd" />
      </body>
      <title>The Common “Thing” Antipattern</title>
      <guid isPermaLink="false">http://www.felicepollano.com/PermaLink.aspx?guid=d8e295cc-734b-41d7-ae94-29264822e7fd</guid>
      <link>http://www.felicepollano.com/2013/02/12/TheCommonThingAntipattern.aspx</link>
      <pubDate>Tue, 12 Feb 2013 08:37:14 GMT</pubDate>
      <description>&lt;p align="justify"&gt;
I’ve noticed that sometimes when developer want to embed in they own infrastructure
an external library they feel the needing of encapsulate that dependency in a common-versus-tool
library. So we have a plethora of, just for say CommonLogging, CommonIoC, CommonOrm
and so on, every one claiming the ability of “Just Plug The Tool”. 
&lt;/p&gt;
&lt;p align="justify"&gt;
I would like to try to show why this is a tremendously ugly antipattern in my opinion,
by showing the side effects of this approach, and alternative solutions.
&lt;/p&gt;
&lt;h2&gt;
&lt;/h2&gt;
&lt;p align="justify"&gt;
&lt;/p&gt;
&lt;h4&gt;1.CommonIoC or CommonServiceLocator (squared antipattern) 
&lt;/h4&gt;
&lt;p align="justify"&gt;
The first impressive attempt is trying to insulate the IoC kernel we want to use.
So instead on having the application depending on the IoC, we just have the App depending
on the CommmonThing, we do some work in creating it, we have back nothing but a boring
piece of code to maintain. The spectacular attempt is when the encapsulated guy is
the service locator, that guy kill by its own the entire effort in code decoupling,
make component dependency obscure to everyone else but the developer who code the
component in the first week. So creating the common layer just multiply the side effects
and the result is a squared antipattern that scares any reasonable professional.
&lt;/p&gt;
&lt;p align="justify"&gt;
The solution: In this case there is a pattern that is a real silver bullet : &lt;a href="http://blog.ploeh.dk/2011/07/28/CompositionRoot.aspx" target="_blank"&gt;Composition
Root&lt;/a&gt;. Just have the IoC used in a single point and have it’s effect propagating
trough all the application by using the proper IoC features: Inject into constructors,
use factories and have the IoC effect recursively propagate among all the application
without referring directly the kernel. In the root, use all the IoC features you have,
by not having the common thing around you, you have no lowest common denominator to
deal with. If you want to change the IoC in the future, you completely rewrite this
single file, and you will use all the new kernel features. You must avoid using byzantine
attributes for injecting your properties, if the IoC you mind to use need them, is
not the correct one. A side effect of this approach could be an increasing amount
of factories class. While this could be considered a problem some IoC offer some sort
of automatic factories, out of the box or with additional plugin. I’m not sure if
they help or not, i fear that code became too magic, and this will possibly violate
the “&lt;a href="http://www.codinghorror.com/blog/2008/06/coding-for-violent-psychopaths.html" target="_blank"&gt;Coding
For a Violent Psycopaths&lt;/a&gt;” principle. As a least consideration: IoC is for applications,
it is not for libraries. If you are writing an infrastructure reusable component,
you must not base it on any IoC strategy. Things are a little different if you are
creating a framework, and this framework leverages and offer services when an IoC
exist in the hosting application. Even in this case, instead of creating a common
thing, the framework should provide&lt;strong&gt; its own IoC abstraction,&lt;/strong&gt; and
the hosting application must provide an adapter to the IoC currently used. The framework
abstraction must be designed in order to fully satisfy the framework requirements,
leaving the adapter implementer the challenge its own IoC. A good example of a framework
using the described strategy is &lt;a href="http://caliburnmicro.codeplex.com/" target="_blank"&gt;Caliburn
Micro&lt;/a&gt;.
&lt;/p&gt;
&lt;p align="justify"&gt;
&lt;/p&gt;
&lt;h4&gt;2.Common logging
&lt;/h4&gt;
&lt;p align="justify"&gt;
Since every good appealing applications logs, this is a real temptation for the CommonLogging
beast. Even not considering the fact that the logging libraries used in production
are about two, why we need this? Please enumerate how many time you decide to drop
a logger in favour of another, end eve if this was the case, was really this refactoring
time jeopardizing the project? Another danger coming from the CommonBeast here is
the fact that being such a library “too small” to be justified, it can possibly collapse
in another anti pattern: “&lt;em&gt;The enterprise magic library&lt;/em&gt;”, a library containing
a set of more or less useful thing that every developer want to maintain when new
stuff has to be added, and no one feel responsible when it breaks. 
&lt;/p&gt;
&lt;p align="justify"&gt;
The solution: Is the same as above: define the logging interface in the library, and
let the application implement it. A great example on this comes form &lt;a href="http://nhforge.org" target="_blank"&gt;NHibernate&lt;/a&gt;.
NH was strictly bound with log4net till version 3.xxx, starting from there you can
implement its own abstract logging interface. Beautiful to have, NH uses log4net as
a default by dynamically loading it ( eliminating the needing of having log4net at
compile time ) degrading gracefully to the old behavior. 
&lt;/p&gt;
&lt;h4&gt;3.Common OR/M
&lt;/h4&gt;
&lt;p align="justify"&gt;
This is probably the worst. An OR/m already introduce a sensible impedance toward
the database, adding an home made abstraction layer pretending to deal wit NH, EF
add another &lt;strong&gt;multiplying&lt;/strong&gt; impedance to your application. Writing an
application that leverages an OR/M is usually a collection of best practices that
OR/M imposes to make the data access as faster as possible. Such trick are usually
difficult to abstract and you don’t know a lot of them until you face it.
&lt;/p&gt;
&lt;p align="justify"&gt;
The solution: First solution is don’t do it at all. it is not a so strange scenario
to choose the or/m you want to use in the design phase, and bring it to production
and maintenance simply with that or/m. By the way software makes money when it does
what the customer want, not when is modified to follow the latest trend in data access.
Another less strict solution is to use the &lt;em&gt;“query object pattern”,&lt;/em&gt; that does
not mean implement your ad hoc query provider, but means encapsulate each aggregates
operation in single classes responsible for all the data access, exposing proper and
useful methods to refine the query specialized for the aggregate. This allow a conceptually
easy refactoring if we want to change the OR/M. And by the way in an every day experience
scenario, you mostly don’t swap NH or EF, but more probably you want to change some
of your query object to use some micro OR/m for performance reason.
&lt;/p&gt;
&lt;p align="justify"&gt;
&lt;/p&gt;
&lt;p align="justify"&gt;
The example series could be extended to the same degree of utility libraries we use.
A CommonMessaging the first one comes in mind.The point is that the “CommonThing”
is a worst practice, it gives us no advantages but just pain and problems, so use
all the effort to avoid it and focalize into the real problem.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.felicepollano.com/aggbug.ashx?id=d8e295cc-734b-41d7-ae94-29264822e7fd" /&gt;</description>
      <comments>http://www.felicepollano.com/CommentView.aspx?guid=d8e295cc-734b-41d7-ae94-29264822e7fd</comments>
      <category>Programming</category>
      <category>pattern</category>
    </item>
    <item>
      <trackback:ping>http://www.felicepollano.com/Trackback.aspx?guid=5553ebb4-4490-436a-99f4-4855089b6921</trackback:ping>
      <pingback:server>http://www.felicepollano.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.felicepollano.com/PermaLink.aspx?guid=5553ebb4-4490-436a-99f4-4855089b6921</pingback:target>
      <dc:creator>Felice Pollano</dc:creator>
      <wfw:comment>http://www.felicepollano.com/CommentView.aspx?guid=5553ebb4-4490-436a-99f4-4855089b6921</wfw:comment>
      <wfw:commentRss>http://www.felicepollano.com/SyndicationService.asmx/GetEntryCommentsRss?guid=5553ebb4-4490-436a-99f4-4855089b6921</wfw:commentRss>
      <slash:comments>1</slash:comments>
      <title>From NH to Dapper: what's missing from a fully fledged OR/M?</title>
      <guid isPermaLink="false">http://www.felicepollano.com/PermaLink.aspx?guid=5553ebb4-4490-436a-99f4-4855089b6921</guid>
      <link>http://www.felicepollano.com/2012/07/25/FromNHToDapperWhatsMissingFromAFullyFledgedORM.aspx</link>
      <pubDate>Wed, 25 Jul 2012 10:32:20 GMT</pubDate>
      <description>&lt;p style="TEXT-ALIGN: justify"&gt;
I just did some new project at work with heavy and extensive usage of data access
over legacy databases, and I tried the &lt;a href="http://code.google.com/p/dapper-dot-net/"&gt;DapperDotNet&lt;/a&gt; micro
or/m instead of NHibernate. I just point before the fact that I've already all the
infrastructure to map such a legacy DB in NH by using mapping by code and leveraging
a lot of conventios in the DB table/field naming, so the mapping work does not make
any difference for me, a part the fact that it is not needed with dapper ( or at least,
not needed in the Entity based form ) since you just map the data transfer structures.
So what's missing from using NH? Lets see:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;div style="TEXT-ALIGN: justify"&gt;&lt;strong&gt;Inheritance&lt;/strong&gt; I was a little worried
about Dapper leak of support for any kind of inheritance concept, but really I managed
to do all the requirement without it, &lt;a href="http://www.infoq.com/articles/ORM-Saffron-Conery"&gt;having
the best dsl for querying the database&lt;/a&gt; did the work.
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;div style="TEXT-ALIGN: justify"&gt;&lt;strong&gt;Identity Map&lt;/strong&gt; We have to keep an
eye to the fact the identity map does not exist anymore using a micro/orm. This not
just in subsequnt queries in the same section, but when we load associations, expecially
when the associated class has a lot of data. For example I had an association with
an entity containing a big bounch of xml, if I load that association in a dto, I need
to manage myself to load it just when the associated id changes.
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;div style="TEXT-ALIGN: justify"&gt;&lt;strong&gt;Lazy Collections&lt;/strong&gt; using Dapper we
have to forget such automatic features, basically there is not such a concept, but
I really can live without it.
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;div style="TEXT-ALIGN: justify"&gt;&lt;strong&gt;Db Schema Create/Update&lt;/strong&gt; I really
miss that just in unit testing. You have to craft the schema by hand in your unit
test. In production in my case I have no control for the schema generation *at all*
so it is not a problem anyway, but I guess the NH update / generation is not enough
for a real DB deployment. You probably need a DB migration in any case.
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;div style="TEXT-ALIGN: justify"&gt;&lt;strong&gt;Linq/Hql&lt;/strong&gt; In fact I miss LinqToNh.
Not absolutely Hql. But we have to consider that a big portion of the impedence an
OR/M introduces is caused to the creation of a DSL on top of plain SQL.
&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p style="TEXT-ALIGN: justify"&gt;
&lt;strong&gt;Let's consider the pure benefit we have from Dapper&lt;/strong&gt;:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;div style="TEXT-ALIGN: justify"&gt;Any kind of optimized SQL is easy to submit.
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;div style="TEXT-ALIGN: justify"&gt;Calling an SP handling In/out parametrs is simple
as calling a query
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;div style="TEXT-ALIGN: justify"&gt;&lt;&gt; in NH )&lt;/div&gt;Multiple resultset are easy to handle
( The Future 
&lt;/li&gt;
&lt;li&gt;
&lt;div style="TEXT-ALIGN: justify"&gt;Bulk operations are easy too ( you still need real
bulk if you realaly want to insert big amount of data )
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;div style="TEXT-ALIGN: justify"&gt;Really noticeable increase in performance, due to
smart ADO.NET underlayng access and to the fact we control the SQL roundtrip ourself
)
&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p style="TEXT-ALIGN: justify"&gt;
So in my opinion: we probably code a little more in the data access phase, but we
have more control, there is no a separate "mapping" part, that can be not so easy
to mantain, but it really worth the effort to &lt;strong&gt;move definitely&lt;/strong&gt; in
the &lt;strong&gt;Micro Orm&lt;/strong&gt; direction.
&lt;/p&gt;
&lt;p style="TEXT-ALIGN: justify"&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.felicepollano.com/aggbug.ashx?id=5553ebb4-4490-436a-99f4-4855089b6921" /&gt;</description>
      <comments>http://www.felicepollano.com/CommentView.aspx?guid=5553ebb4-4490-436a-99f4-4855089b6921</comments>
      <category>C#</category>
      <category>NHibernate</category>
      <category>ORM</category>
    </item>
    <item>
      <trackback:ping>http://www.felicepollano.com/Trackback.aspx?guid=17b081fa-d909-492d-848b-4a0eb158b75c</trackback:ping>
      <pingback:server>http://www.felicepollano.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.felicepollano.com/PermaLink.aspx?guid=17b081fa-d909-492d-848b-4a0eb158b75c</pingback:target>
      <dc:creator>Felice Pollano</dc:creator>
      <wfw:comment>http://www.felicepollano.com/CommentView.aspx?guid=17b081fa-d909-492d-848b-4a0eb158b75c</wfw:comment>
      <wfw:commentRss>http://www.felicepollano.com/SyndicationService.asmx/GetEntryCommentsRss?guid=17b081fa-d909-492d-848b-4a0eb158b75c</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
As <a href="http://weblogs.asp.net/scottgu/archive/2012/07/19/entity-framework-and-open-source.aspx">announced
by Scott Guthrie</a> EF is today available as Open Source on <a href="http://entityframework.codeplex.com/">Codeplex</a>.
As usual I had a first glance at the code to see what's inside. Is a big codebase
as you can guess,but even with a first sight it is possible to spot some interesting
things to learn. Here my list:
</p>
        <ul>
          <li>
            <a href="http://entityframework.codeplex.com/SourceControl/changeset/view/f26ae451505b#src/EntityFramework.PowerShell/ConnectionFactoryConfig/SqlServerDetector.cs">Discover
local Sql server instances</a>
          </li>
          <li>
            <a href="http://entityframework.codeplex.com/SourceControl/changeset/view/f26ae451505b#src/EntityFramework/Utilities/TypeExtensions.cs">Interesting
Type extensions ( IsNullable/IsCollection )</a>
          </li>
          <li>
            <a href="http://entityframework.codeplex.com/SourceControl/changeset/view/f26ae451505b#src/EntityFramework/Utilities/ExpressionExtensions.cs">Extension
for LambdaExpression</a>
          </li>
          <li>
            <a href="http://entityframework.codeplex.com/SourceControl/changeset/view/f26ae451505b#src/EntityFramework.SqlServer/SqlGen/SqlGenerator.cs">A
fully fledged ExpressionVisitor generating SQL</a>
          </li>
          <li>
            <a href="http://entityframework.codeplex.com/SourceControl/changeset/view/f26ae451505b#src/EntityFramework/Migrations/Utilities/IndentedTextWriter.cs">A
TextWriter with Ident support</a>
          </li>
        </ul>
        <p>
So nothing really complex, just good code snippets. Interesting, they internally uses <a href="http://xunit.codeplex.com/">XUnit</a> for
unit testing, not MSTest, and the framework for mocking is <a href="http://moq.github.com/moq/">MoQ</a>.
</p>
        <img width="0" height="0" src="http://www.felicepollano.com/aggbug.ashx?id=17b081fa-d909-492d-848b-4a0eb158b75c" />
      </body>
      <title>The 5 thing to immediately grab from EF Open Source</title>
      <guid isPermaLink="false">http://www.felicepollano.com/PermaLink.aspx?guid=17b081fa-d909-492d-848b-4a0eb158b75c</guid>
      <link>http://www.felicepollano.com/2012/07/20/The5ThingToImmediatelyGrabFromEFOpenSource.aspx</link>
      <pubDate>Fri, 20 Jul 2012 09:31:10 GMT</pubDate>
      <description>
&lt;p&gt;
As &lt;a href="http://weblogs.asp.net/scottgu/archive/2012/07/19/entity-framework-and-open-source.aspx"&gt;announced
by Scott Guthrie&lt;/a&gt; EF is today available as Open Source on &lt;a href="http://entityframework.codeplex.com/"&gt;Codeplex&lt;/a&gt;.
As usual I had a first glance at the code to see what's inside. Is a big codebase
as you can guess,but even with a first sight it is possible to spot some interesting
things to learn. Here my list:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href="http://entityframework.codeplex.com/SourceControl/changeset/view/f26ae451505b#src/EntityFramework.PowerShell/ConnectionFactoryConfig/SqlServerDetector.cs"&gt;Discover
local Sql server instances&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="http://entityframework.codeplex.com/SourceControl/changeset/view/f26ae451505b#src/EntityFramework/Utilities/TypeExtensions.cs"&gt;Interesting
Type extensions ( IsNullable/IsCollection )&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="http://entityframework.codeplex.com/SourceControl/changeset/view/f26ae451505b#src/EntityFramework/Utilities/ExpressionExtensions.cs"&gt;Extension
for LambdaExpression&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="http://entityframework.codeplex.com/SourceControl/changeset/view/f26ae451505b#src/EntityFramework.SqlServer/SqlGen/SqlGenerator.cs"&gt;A
fully fledged ExpressionVisitor generating SQL&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="http://entityframework.codeplex.com/SourceControl/changeset/view/f26ae451505b#src/EntityFramework/Migrations/Utilities/IndentedTextWriter.cs"&gt;A
TextWriter with Ident support&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
So nothing really complex, just good code snippets. Interesting, they internally uses &lt;a href="http://xunit.codeplex.com/"&gt;XUnit&lt;/a&gt; for
unit testing, not MSTest, and the framework for mocking is &lt;a href="http://moq.github.com/moq/"&gt;MoQ&lt;/a&gt;.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.felicepollano.com/aggbug.ashx?id=17b081fa-d909-492d-848b-4a0eb158b75c" /&gt;</description>
      <comments>http://www.felicepollano.com/CommentView.aspx?guid=17b081fa-d909-492d-848b-4a0eb158b75c</comments>
      <category>C#</category>
      <category>CodeProject</category>
    </item>
    <item>
      <trackback:ping>http://www.felicepollano.com/Trackback.aspx?guid=26bfb9eb-39ac-4e51-9392-61662b47ccd0</trackback:ping>
      <pingback:server>http://www.felicepollano.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.felicepollano.com/PermaLink.aspx?guid=26bfb9eb-39ac-4e51-9392-61662b47ccd0</pingback:target>
      <dc:creator>Felice Pollano</dc:creator>
      <wfw:comment>http://www.felicepollano.com/CommentView.aspx?guid=26bfb9eb-39ac-4e51-9392-61662b47ccd0</wfw:comment>
      <wfw:commentRss>http://www.felicepollano.com/SyndicationService.asmx/GetEntryCommentsRss?guid=26bfb9eb-39ac-4e51-9392-61662b47ccd0</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
I recently started playing with <a href="http://data.stackexchange.com/" target="_blank">stackexchange
data</a>. You can use that web app to look up existing queries created by other users
or create your own, against any <a href="http://stackexchange.com/" target="_blank">stackexchange</a> site.
If you are asking how you can obtain, for example, how many time a certain tag is
viewed as a part of a question  to discover what’s ‘trendy’ if you think that
the number of questions and aswers ( and the views count ) are meaningful by this
point of view. If you think this is interesting you can leverage stackexchange data
to extract almost whatever you want. Here below some example:
</p>
        <h5>
          <a href="http://data.stackexchange.com/stackoverflow/query/73713/top-20-viewed-tag-in-the-last-30-days" target="_blank">top
20 ‘Trending’ Tags in the last 30 days</a>
        </h5>
        <p>
          <a href="http://www.felicepollano.com/public/Windows-Live-Writer/7ffba89c68d9_8496/image_2.png">
            <img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.felicepollano.com/public/Windows-Live-Writer/7ffba89c68d9_8496/image_thumb.png" width="670" height="424" />
          </a>
        </p>
        <p>
Or if you are curious about your position in your country in term of reputation you
can modify this query:
</p>
        <h5>
          <a href="http://data.stackexchange.com/stackoverflow/query/73801/top-20-user-from-italy-by-reputation" target="_blank">top
20 users classified by reputation in Italy</a>
        </h5>
        <p>
          <a href="http://www.felicepollano.com/public/Windows-Live-Writer/7ffba89c68d9_8496/image_6.png">
            <img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.felicepollano.com/public/Windows-Live-Writer/7ffba89c68d9_8496/image_thumb_2.png" width="731" height="400" />
          </a>
        </p>
        <img width="0" height="0" src="http://www.felicepollano.com/aggbug.ashx?id=26bfb9eb-39ac-4e51-9392-61662b47ccd0" />
      </body>
      <title>Some Stats about Stackoverflow</title>
      <guid isPermaLink="false">http://www.felicepollano.com/PermaLink.aspx?guid=26bfb9eb-39ac-4e51-9392-61662b47ccd0</guid>
      <link>http://www.felicepollano.com/2012/06/25/SomeStatsAboutStackoverflow.aspx</link>
      <pubDate>Mon, 25 Jun 2012 09:16:50 GMT</pubDate>
      <description>&lt;p&gt;
I recently started playing with &lt;a href="http://data.stackexchange.com/" target="_blank"&gt;stackexchange
data&lt;/a&gt;. You can use that web app to look up existing queries created by other users
or create your own, against any &lt;a href="http://stackexchange.com/" target="_blank"&gt;stackexchange&lt;/a&gt; site.
If you are asking how you can obtain, for example, how many time a certain tag is
viewed as a part of a question&amp;nbsp; to discover what’s ‘trendy’ if you think that
the number of questions and aswers ( and the views count ) are meaningful by this
point of view. If you think this is interesting you can leverage stackexchange data
to extract almost whatever you want. Here below some example:
&lt;/p&gt;
&lt;h5&gt;&lt;a href="http://data.stackexchange.com/stackoverflow/query/73713/top-20-viewed-tag-in-the-last-30-days" target="_blank"&gt;top
20 ‘Trending’ Tags in the last 30 days&lt;/a&gt;
&lt;/h5&gt;
&lt;p&gt;
&lt;a href="http://www.felicepollano.com/public/Windows-Live-Writer/7ffba89c68d9_8496/image_2.png"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.felicepollano.com/public/Windows-Live-Writer/7ffba89c68d9_8496/image_thumb.png" width="670" height="424"&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
Or if you are curious about your position in your country in term of reputation you
can modify this query:
&lt;/p&gt;
&lt;h5&gt;&lt;a href="http://data.stackexchange.com/stackoverflow/query/73801/top-20-user-from-italy-by-reputation" target="_blank"&gt;top
20 users classified by reputation in Italy&lt;/a&gt;
&lt;/h5&gt;
&lt;p&gt;
&lt;a href="http://www.felicepollano.com/public/Windows-Live-Writer/7ffba89c68d9_8496/image_6.png"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.felicepollano.com/public/Windows-Live-Writer/7ffba89c68d9_8496/image_thumb_2.png" width="731" height="400"&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.felicepollano.com/aggbug.ashx?id=26bfb9eb-39ac-4e51-9392-61662b47ccd0" /&gt;</description>
      <comments>http://www.felicepollano.com/CommentView.aspx?guid=26bfb9eb-39ac-4e51-9392-61662b47ccd0</comments>
    </item>
  </channel>
</rss>