<?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: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:dc="http://purl.org/dc/elements/1.1/" version="2.0">
  <channel>
    <title>Felice Pollano Blog - C#</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=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>
  </channel>
</rss>