<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Agustino&#039;s Blog</title>
	<atom:link href="http://agustinosorio.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://agustinosorio.wordpress.com</link>
	<description>A few of technology and other things</description>
	<lastBuildDate>Mon, 25 Oct 2010 15:47:12 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='agustinosorio.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Agustino&#039;s Blog</title>
		<link>http://agustinosorio.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://agustinosorio.wordpress.com/osd.xml" title="Agustino&#039;s Blog" />
	<atom:link rel='hub' href='http://agustinosorio.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Caminar sobre el agua</title>
		<link>http://agustinosorio.wordpress.com/2010/10/25/caminar-sobre-el-agua/</link>
		<comments>http://agustinosorio.wordpress.com/2010/10/25/caminar-sobre-el-agua/#comments</comments>
		<pubDate>Mon, 25 Oct 2010 15:47:12 +0000</pubDate>
		<dc:creator>Agustino</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://agustinosorio.wordpress.com/?p=33</guid>
		<description><![CDATA[Desarrollar sobre requerimientos es tan facil como caminar sobre el agua&#8230; Siempre y cuando se encuentren congelados.<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=agustinosorio.wordpress.com&amp;blog=9291823&amp;post=33&amp;subd=agustinosorio&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Desarrollar sobre requerimientos es tan facil como caminar sobre el agua&#8230;</p>
<p>Siempre y cuando se encuentren congelados.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/agustinosorio.wordpress.com/33/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/agustinosorio.wordpress.com/33/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/agustinosorio.wordpress.com/33/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/agustinosorio.wordpress.com/33/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/agustinosorio.wordpress.com/33/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/agustinosorio.wordpress.com/33/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/agustinosorio.wordpress.com/33/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/agustinosorio.wordpress.com/33/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/agustinosorio.wordpress.com/33/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/agustinosorio.wordpress.com/33/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/agustinosorio.wordpress.com/33/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/agustinosorio.wordpress.com/33/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/agustinosorio.wordpress.com/33/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/agustinosorio.wordpress.com/33/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=agustinosorio.wordpress.com&amp;blog=9291823&amp;post=33&amp;subd=agustinosorio&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://agustinosorio.wordpress.com/2010/10/25/caminar-sobre-el-agua/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/199c475fdbfb0467374f925591e93bd5?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Agustino</media:title>
		</media:content>
	</item>
		<item>
		<title>SQL ~ Grouping by Date, based on the date Part</title>
		<link>http://agustinosorio.wordpress.com/2009/09/30/sql-grouping-by-date-based-on-the-date-part/</link>
		<comments>http://agustinosorio.wordpress.com/2009/09/30/sql-grouping-by-date-based-on-the-date-part/#comments</comments>
		<pubDate>Wed, 30 Sep 2009 19:23:30 +0000</pubDate>
		<dc:creator>Agustino</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://agustinosorio.wordpress.com/2009/09/30/sql-grouping-by-date-based-on-the-date-part/</guid>
		<description><![CDATA[Every body knows that Grouping in a SQL query is one of the most commonly used techniques for Summarizing or even getting statistical reports based on what we have in database, but when it comes to Date Grouping its kind of messy because of the Hour part of the DateTime data type in SQL. So [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=agustinosorio.wordpress.com&amp;blog=9291823&amp;post=24&amp;subd=agustinosorio&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Every body knows that Grouping in a SQL query is one of the most commonly used techniques for Summarizing or even getting statistical reports based on what we have in database, but when it comes to Date Grouping its kind of messy because of the Hour part of the DateTime data type in SQL.</p>
<p>So having the following data table:</p>
<p><strong>CreateDate                        Identifier<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;        &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</strong><br />
2008-10-02 19:49:43.733 NYUB04EOB<br />
2008-10-02 19:53:45.067 NYUB04EOB<br />
2008-10-02 19:53:45.147 NYUB04EOB<br />
2008-10-02 19:58:44.713 NYUB04EOB BC<br />
2008-10-03 20:39:34.357 NYUB04EOB<br />
2008-10-03 20:39:34.387 NYUB04EOB<br />
2008-10-03 21:24:30.680 NYUB04EOB</p>
<p>we would like to group in some thing like:</p>
<p><strong>CreateDate                        IdentifierCount<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;        &#8212;&#8212;&#8212;&#8211;</strong></p>
<p>2008-10-02 00:00:00.000 4<br />
2008-10-03 00:00:00.000 11<br />
2008-10-06 00:00:00.000 11<br />
2008-10-07 00:00:00.000 17<br />
2008-10-08 00:00:00.000 5<br />
2008-10-09 00:00:00.000 4<br />
2008-10-10 00:00:00.000 7</p>
<p>There is actually two ways for accomplish this, the first on is assuming that you have SQL 2008 installed you could use the convert() function to do a cast to the new Date Data Type</p>
<p>SELECT Convert(Date,Createdate,101) as CreateDate, count(Identifier) as IdentifierCount<br />
FROM MyTable<br />
group by Convert(Date,Createdate,101)</p>
<p>The Second one is in the case that you have previous versions of SQL like 2005 or 2003, in that case the Date dataType does not exist in the short version as in 2008, so the solution is kind of tricky, ans you will have to use a DateAdd function call like follows:</p>
<p>SELECT top 100  <em>dateadd(dd,0, datediff(dd,0,i.CreateDate))</em> as CreateDate<br />
        ,Count(t.itypename) As Identifier       <br />
FROM [dbo].[tritem] i (nolock) inner join<br />
        dbo.trItemUDFDocumentUDFs u (nolock) on i.itemid = u.itemid inner join<br />
        dbo.trItemType t (nolock) on i.itypeid = t.itypeid<br />
WHERE t.itypename like &#8216;%EOB%&#8217; and u.voided &lt;&gt; &#8216;Y&#8217;<br />
group by <em>dateadd(dd,0, datediff(dd,0,i.CreateDate))</em><br />
order by dateadd(dd,0, datediff(dd,0,i.CreateDate))</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/agustinosorio.wordpress.com/24/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/agustinosorio.wordpress.com/24/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/agustinosorio.wordpress.com/24/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/agustinosorio.wordpress.com/24/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/agustinosorio.wordpress.com/24/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/agustinosorio.wordpress.com/24/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/agustinosorio.wordpress.com/24/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/agustinosorio.wordpress.com/24/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/agustinosorio.wordpress.com/24/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/agustinosorio.wordpress.com/24/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/agustinosorio.wordpress.com/24/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/agustinosorio.wordpress.com/24/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/agustinosorio.wordpress.com/24/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/agustinosorio.wordpress.com/24/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=agustinosorio.wordpress.com&amp;blog=9291823&amp;post=24&amp;subd=agustinosorio&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://agustinosorio.wordpress.com/2009/09/30/sql-grouping-by-date-based-on-the-date-part/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/199c475fdbfb0467374f925591e93bd5?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Agustino</media:title>
		</media:content>
	</item>
		<item>
		<title>SQL Reporting Services 2008 and Anonymous Authentication</title>
		<link>http://agustinosorio.wordpress.com/2009/09/21/sql-reporting-services-2008-and-anonymous-authentication/</link>
		<comments>http://agustinosorio.wordpress.com/2009/09/21/sql-reporting-services-2008-and-anonymous-authentication/#comments</comments>
		<pubDate>Mon, 21 Sep 2009 20:55:08 +0000</pubDate>
		<dc:creator>Agustino</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SSRS]]></category>

		<guid isPermaLink="false">http://agustinosorio.wordpress.com/2009/09/21/sql-reporting-services-2008-and-anonymous-authentication/</guid>
		<description><![CDATA[SQL has made very intresting progress in functionality with his 2008 version, like the nice intelisense coding functionality and better look and feel for SQL Reporting services, this last is even easier to develop with friendly nice controls and functionality… But, what happened to the site administration through IIS and Anonymous Authentication? Well, IIS administration [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=agustinosorio.wordpress.com&amp;blog=9291823&amp;post=22&amp;subd=agustinosorio&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>SQL has made very intresting progress in functionality with his 2008 version, like the nice intelisense coding functionality and better look and feel for SQL Reporting services, this last is even easier to develop with friendly nice controls and functionality… But, what happened to the site administration through IIS and Anonymous Authentication?</p>
<p>Well, IIS administration option is a</p>
<div id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:b6edf9f2-b625-4a11-b439-1013c66f573b" class="wlWriterEditableSmartContent" style="display:inline;float:none;margin:0;padding:0;">Technorati Tags: <a rel="tag" href="http://technorati.com/tags/SQL">SQL</a></div>
<p>mystery to me now, in regards of the Anonymous authentication there are a couple of good reasons for getting rid of it, and most of them have to due with Security and best practices, but there are some specific cases where you may want certain users to have access to the reports through the reports servers, here is a nice work around I&#8217;ve found on Microsoft site.</p>
<p> </p>
<p><a title="http://blogs.msdn.com/jameswu/archive/2008/07/15/anonymous-access-in-sql-rs-2008.aspx" href="http://blogs.msdn.com/jameswu/archive/2008/07/15/anonymous-access-in-sql-rs-2008.aspx">http://blogs.msdn.com/jameswu/archive/2008/07/15/anonymous-access-in-sql-rs-2008.aspx</a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/agustinosorio.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/agustinosorio.wordpress.com/22/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/agustinosorio.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/agustinosorio.wordpress.com/22/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/agustinosorio.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/agustinosorio.wordpress.com/22/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/agustinosorio.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/agustinosorio.wordpress.com/22/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/agustinosorio.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/agustinosorio.wordpress.com/22/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/agustinosorio.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/agustinosorio.wordpress.com/22/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/agustinosorio.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/agustinosorio.wordpress.com/22/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=agustinosorio.wordpress.com&amp;blog=9291823&amp;post=22&amp;subd=agustinosorio&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://agustinosorio.wordpress.com/2009/09/21/sql-reporting-services-2008-and-anonymous-authentication/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/199c475fdbfb0467374f925591e93bd5?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Agustino</media:title>
		</media:content>
	</item>
		<item>
		<title>Trouble shooting Crystal Reports deploying issues</title>
		<link>http://agustinosorio.wordpress.com/2009/09/08/trouble-shooting-crystal-reports-deploying-issues/</link>
		<comments>http://agustinosorio.wordpress.com/2009/09/08/trouble-shooting-crystal-reports-deploying-issues/#comments</comments>
		<pubDate>Tue, 08 Sep 2009 16:13:40 +0000</pubDate>
		<dc:creator>Agustino</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[Crystal]]></category>

		<guid isPermaLink="false">http://agustinosorio.wordpress.com/2009/09/08/trouble-shooting-crystal-reports-deploying-issues/</guid>
		<description><![CDATA[THE ISSUE Could not load file or assembly ‘CrystalDecisions.Windows.Forms, Version 10.5.3700.0, Culture=neutral, PublicKeyToken=692fbea5521e1304’ or one of its dependencies. The system cannot find the file specified. This is a commonly seen exception thrown when deploying applications using Crystal Repots, this one specifically is in a VS 2008 application. The issue is caused because nor crystal or [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=agustinosorio.wordpress.com&amp;blog=9291823&amp;post=16&amp;subd=agustinosorio&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><strong>THE ISSUE<br />
</strong><em>Could not load file or assembly ‘CrystalDecisions.Windows.Forms, Version 10.5.3700.0, Culture=neutral, PublicKeyToken=692fbea5521e1304’ or one of its dependencies. The system cannot find the file specified.</em></p>
<p>This is a commonly seen exception thrown when deploying applications using Crystal Repots, this one specifically is in a VS 2008 application.</p>
<p>The issue is caused because nor crystal or visual studio include the needed assemblies on the bin directory, not even when creating a set up project for your application.</p>
<p><strong>THE SOLUTION</strong></p>
<p>So there are two solutions available, the first one is to get the merge modules into your set up project, that way you will ensure that the assemblies are included and registered in the installation machine</p>
<p>See <a href="http://msdn.microsoft.com/en-us/library/aa287928(VS.71).aspx">http://msdn.microsoft.com/en-us/library/aa287928(VS.71).aspx</a> for more refference.</p>
<p>How ever not all the time you are dealing with set up projects and the fast solution is to run a MSI installer, if you have visual studio 2008 installed just navigate to<br />
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Bootstrapper\Packages\CrystalReports10_5 </p>
<p><a href="http://agustinosorio.files.wordpress.com/2009/09/image2.png"><img style="border-bottom:0;border-left:0;display:inline;border-top:0;border-right:0;" title="image" src="http://agustinosorio.files.wordpress.com/2009/09/image_thumb2.png?w=237&#038;h=195" border="0" alt="image" width="237" height="195" /></a></p>
<p>And run the appropriate MSI.</p>
<p>That will make the trick.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/agustinosorio.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/agustinosorio.wordpress.com/16/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/agustinosorio.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/agustinosorio.wordpress.com/16/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/agustinosorio.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/agustinosorio.wordpress.com/16/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/agustinosorio.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/agustinosorio.wordpress.com/16/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/agustinosorio.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/agustinosorio.wordpress.com/16/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/agustinosorio.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/agustinosorio.wordpress.com/16/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/agustinosorio.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/agustinosorio.wordpress.com/16/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=agustinosorio.wordpress.com&amp;blog=9291823&amp;post=16&amp;subd=agustinosorio&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://agustinosorio.wordpress.com/2009/09/08/trouble-shooting-crystal-reports-deploying-issues/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/199c475fdbfb0467374f925591e93bd5?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Agustino</media:title>
		</media:content>

		<media:content url="http://agustinosorio.files.wordpress.com/2009/09/image_thumb2.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>
	</item>
		<item>
		<title>WCF Guide Lines ~ Separating Service/Client from contracts</title>
		<link>http://agustinosorio.wordpress.com/2009/09/02/wcf-guide-lines-separating-serviceclient-from-contracts/</link>
		<comments>http://agustinosorio.wordpress.com/2009/09/02/wcf-guide-lines-separating-serviceclient-from-contracts/#comments</comments>
		<pubDate>Wed, 02 Sep 2009 15:25:58 +0000</pubDate>
		<dc:creator>Agustino</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[WCF]]></category>

		<guid isPermaLink="false">http://agustinosorio.wordpress.com/2009/09/02/wcf-guide-lines-separating-serviceclient-from-contracts/</guid>
		<description><![CDATA[Begining WCF is some how confusing when not having idea how the technology works, in this article we analyze a way to make it simple<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=agustinosorio.wordpress.com&amp;blog=9291823&amp;post=8&amp;subd=agustinosorio&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Recently (1 year or so) I started applying .NET WCF into some functionalities across my servers, one thing I noticed on my learning process is the different ways we have for having both the client and the service to be aware of the contracts (both the Service and the Data contract).</p>
<p>THE PROBLEM: In design mode we have to have a reliable way for having the same signature for the service contract definition both on the client and the service as well as the data contracts.</p>
<p>One way to achieve this is to use the service reference functionality, which will automatically generate all a set of proxy classes for interfacing with any client we are working on it, Very useful and easy to implement, the downside of this is that we don’t have much control of what happens in the background, and if you are a WCF Rookie as I am, you will find the resulting classes extensively overwhelming. One more thing I don’t like about it is the fact that it does not give you control on the creation of the channels, which many times you will want to control.</p>
<p>THE GUIDELINE (Solution): Start creating a kind of three layers solution for separating the Service/Proxy/Client Functionality.</p>
<p><a href="http://agustinosorio.files.wordpress.com/2009/09/classes.jpg"><img style="border-bottom:0;border-left:0;display:block;float:none;margin-left:auto;border-top:0;margin-right:auto;border-right:0;" title="Classes" src="http://agustinosorio.files.wordpress.com/2009/09/classes_thumb.jpg?w=314&#038;h=264" border="0" alt="Classes" width="314" height="264" /></a></p>
<p>What I heavily recommend is to start by creating a proxy library class project, which will contain the set of interfaces (if more than one service contract is to be defined there) and the set of data contracts.</p>
<p>Then create the service and the client projects in your VS and reference the proxy project on them, this will ensure that any change you make to the service signature will be then implemented at build time on the rest of the projects</p>
<p><a href="http://agustinosorio.files.wordpress.com/2009/09/image.png"><img style="border-bottom:0;border-left:0;display:block;float:none;margin-left:auto;border-top:0;margin-right:auto;border-right:0;" title="image" src="http://agustinosorio.files.wordpress.com/2009/09/image_thumb.png?w=156&#038;h=392" border="0" alt="image" width="156" height="392" /></a></p>
<p>Once you have the different projects then you can go ahead and define what ever interface you want to implement for your service in an interface, on the proxy project:</p>
<p>namespace WCFProxy</p>
<p>{</p>
<p>[ServiceContract(SessionMode = SessionMode.Required,)]</p>
<p>public interface ICetralService</p>
<p>{</p>
<p>[OperationContract(IsOneWay = true)]</p>
<p>void UploadVersion( FileRequest request);</p>
<p>[OperationContract(IsOneWay = true)]</p>
<p>void DownloadVersion();</p>
<p>}</p>
<p>}</p>
<p>Also Define the Data contracts in this same project</p>
<p>namespace WCFProxy</p>
<p>{</p>
<p>[DataContract]</p>
<p>public class FileRequest</p>
<p>{</p>
<p>string _version;</p>
<p>List&lt;byte[]&gt; _fileList = new List&lt;byte[]&gt;();</p>
<p>[DataMember]</p>
<p>public string Version</p>
<p>{ get; set; }</p>
<p>[DataMember]</p>
<p>public List&lt;byte[]&gt; FileList</p>
<p>{ get; set; }</p>
<p>}</p>
<p>}</p>
<p>Next step is to implement the interface on the Service Project:</p>
<p>namespace WCFCentral</p>
<p>{</p>
<p>[ServiceBehavior(AutomaticSessionShutdown = true</p>
<p>, InstanceContextMode = InstanceContextMode.PerSession</p>
<p>, ConcurrencyMode = ConcurrencyMode.Multiple</p>
<p>, UseSynchronizationContext = true)]</p>
<p>class CentralService:WCFProxy.ICetralService</p>
<p>{</p>
<p>#region ICetralService Members</p>
<p>public void UploadVersion(WCFProxy.FileRequest request)</p>
<p>{</p>
<p>//WhatEver code</p>
<p>}</p>
<p>public void DownloadVersion()</p>
<p>{</p>
<p>//WhatEver code</p>
<p>}</p>
<p>#endregion</p>
<p>}</p>
<p>}</p>
<p>You can add any logic, or extra logic on the service, just take into account the host in which the service will be implemented, i.e. do not implement GUI interaction if it is going to be hosted in Win Service</p>
<p>Last but not least is to add the required logic in the client side to instantiate and host the service, this is easily accomplished by using ChannelFactory or DuplexChannelFactory, depending on the type of communication scheme you want to implement:</p>
<p>namespace WCFClient</p>
<p>{</p>
<p>class Client</p>
<p>{</p>
<p>public Client()</p>
<p>{</p>
<p>byte[] b = new byte[5000];//assuming the file to be sent is less that 5000 bytes</p>
<p>WCFProxy.FileRequest req = new WCFProxy.FileRequest();</p>
<p>req.Version = &#8220;1.0.1&#8243;;</p>
<p>b = System.IO.File.ReadAllBytes(&#8220;c:\\anyFile.txt&#8221;);</p>
<p>req.FileList.Add(b);</p>
<p>InstanceContext IC = new InstanceContext(new ClientCallBack());</p>
<p>DuplexChannelFactory&lt;WCFProxy.ICetralService&gt; f = new DuplexChannelFactory&lt;WCFProxy.ICetralService&gt;(IC, &#8220;CentralClient&#8221;);</p>
<p>Svc = f.CreateChannel();</p>
<p>Console.WriteLine(&#8220;about to send&#8221;);</p>
<p>Svc.UploadVersion(req);</p>
<p>Console.ReadKey();</p>
<p>}</p>
<p>private WCFProxy.ICetralService svc;</p>
<p>public WCFProxy.ICetralService Svc</p>
<p>{</p>
<p>get { return svc; }</p>
<p>set { svc = value; }</p>
<p>}</p>
<p>}</p>
<p>}</p>
<p>In this sample we assume there is an endpoint and service definition on the app.config, but this clearly and in an easy way demonstrate that you should not write huge classes or implement complex proxies to connect to any WCF service.</p>
<p>NICE: the important part of this sample is the separation of the contracts (Proxy) from the Service and clients, and the way we ensure that any change made to a contract definition will be distributed across the rest of the elements of a WCF platform.</p>
<p>Also it’s a good practice to have a good Channel handling to ensure that the channel object will open and close and also dispose correctly.</p>
<p>We will cover that in another blog entry.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/agustinosorio.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/agustinosorio.wordpress.com/8/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/agustinosorio.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/agustinosorio.wordpress.com/8/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/agustinosorio.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/agustinosorio.wordpress.com/8/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/agustinosorio.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/agustinosorio.wordpress.com/8/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/agustinosorio.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/agustinosorio.wordpress.com/8/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/agustinosorio.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/agustinosorio.wordpress.com/8/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/agustinosorio.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/agustinosorio.wordpress.com/8/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=agustinosorio.wordpress.com&amp;blog=9291823&amp;post=8&amp;subd=agustinosorio&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://agustinosorio.wordpress.com/2009/09/02/wcf-guide-lines-separating-serviceclient-from-contracts/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/199c475fdbfb0467374f925591e93bd5?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Agustino</media:title>
		</media:content>

		<media:content url="http://agustinosorio.files.wordpress.com/2009/09/classes_thumb.jpg" medium="image">
			<media:title type="html">Classes</media:title>
		</media:content>

		<media:content url="http://agustinosorio.files.wordpress.com/2009/09/image_thumb.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>
	</item>
	</channel>
</rss>
