<?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/"
	>

<channel>
	<title>sharpreflections.net &#187; Microsoft CRM 3.0</title>
	<atom:link href="http://blog.sharpreflections.net/category/microsoft-crm-30/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.sharpreflections.net</link>
	<description>Thoughts about .Net, programming and other more important stuffs.</description>
	<lastBuildDate>Fri, 20 Nov 2009 00:24:04 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Dynamics CRM as development platform: transparent substitution of CrmService with Filtered Views.</title>
		<link>http://blog.sharpreflections.net/2007/04/06/dynamics-crm-as-development-platform-transparent-substitution-of-crmservice-with-filtered-views/</link>
		<comments>http://blog.sharpreflections.net/2007/04/06/dynamics-crm-as-development-platform-transparent-substitution-of-crmservice-with-filtered-views/#comments</comments>
		<pubDate>Fri, 06 Apr 2007 19:41:27 +0000</pubDate>
		<dc:creator>matteosp</dc:creator>
				<category><![CDATA[.Net Programming]]></category>
		<category><![CDATA[Microsoft CRM 3.0]]></category>
		<category><![CDATA[Sql Server]]></category>

		<guid isPermaLink="false">http://sharpreflections.wordpress.com/2007/04/06/dynamics-crm-as-development-platform-transparent-substitution-of-crmservice-with-filtered-views/</guid>
		<description><![CDATA[In my last post I suggested not to directly use, in your code, the CrmService proxy class. I quickly mentioned some enhancements you can gain from this, let&#8217;s focus on substituting web service calls with database access on filtered views. Even if limited to read operations, this can increase a lot the performances of your [...]]]></description>
			<content:encoded><![CDATA[<p>In my last post I suggested not to directly use, in your code, the CrmService proxy class. I quickly mentioned some enhancements you can gain from this, let&#8217;s focus on <strong>substituting web service calls with database access on filtered views</strong>. Even if limited to read operations, this can increase a lot the performances of your system.</p>
<p>As we want the callers not to be aware of the way we retrieve data, we have to passing back data to them in the form they expect it: &#8220;BusinessEntity&#8221; derived classes or collection of them. This may seems hard, but it isn&#8217;t. You can build the statement in way that it will produce data in XML, in a format that can be directly deserialized in entity instances.</p>
<p>So, let&#8217;s view how we can:</p>
<ul>
<li>Compose the SQL statements in such a way the will produce the xml we need</li>
<li>Deserialize the data from xml to entities</li>
</ul>
<p>Take a look at this query:</p>
<pre><a href="http://search.microsoft.com/default.asp?so=RECCNT&amp;siteid=us%2Fdev&amp;p=1&amp;nq=NEW&amp;qu=WITH&amp;IntlSearch=&amp;boolean=PHRASE&amp;ig=01&amp;i=09&amp;i=99">WITH</a> XMLNAMESPACES
(
  '<span style="color:#8b0000;">http://www.w3.org/2001/XMLSchema</span>' <a href="http://search.microsoft.com/default.asp?so=RECCNT&amp;siteid=us%2Fdev&amp;p=1&amp;nq=NEW&amp;qu=as&amp;IntlSearch=&amp;boolean=PHRASE&amp;ig=01&amp;i=09&amp;i=99">as</a> xsd
, '<span style="color:#8b0000;">http://www.w3.org/2001/XMLSchema-instance</span>' <a href="http://search.microsoft.com/default.asp?so=RECCNT&amp;siteid=us%2Fdev&amp;p=1&amp;nq=NEW&amp;qu=as&amp;IntlSearch=&amp;boolean=PHRASE&amp;ig=01&amp;i=09&amp;i=99">as</a> xsi
, '<span style="color:#8b0000;">http://schemas.microsoft.com/crm/2006/WebServices</span>' <a href="http://search.microsoft.com/default.asp?so=RECCNT&amp;siteid=us%2Fdev&amp;p=1&amp;nq=NEW&amp;qu=as&amp;IntlSearch=&amp;boolean=PHRASE&amp;ig=01&amp;i=09&amp;i=99">as</a> crm
)
<a href="http://search.microsoft.com/default.asp?so=RECCNT&amp;siteid=us%2Fdev&amp;p=1&amp;nq=NEW&amp;qu=SELECT&amp;IntlSearch=&amp;boolean=PHRASE&amp;ig=01&amp;i=09&amp;i=99">SELECT</a> name <a href="http://search.microsoft.com/default.asp?so=RECCNT&amp;siteid=us%2Fdev&amp;p=1&amp;nq=NEW&amp;qu=as&amp;IntlSearch=&amp;boolean=PHRASE&amp;ig=01&amp;i=09&amp;i=99">as</a> '<span style="color:#8b0000;">crm:name</span>'
     , accountid <a href="http://search.microsoft.com/default.asp?so=RECCNT&amp;siteid=us%2Fdev&amp;p=1&amp;nq=NEW&amp;qu=as&amp;IntlSearch=&amp;boolean=PHRASE&amp;ig=01&amp;i=09&amp;i=99">as</a> '<span style="color:#8b0000;">crm:accountid</span>'
     , donotphonename <a href="http://search.microsoft.com/default.asp?so=RECCNT&amp;siteid=us%2Fdev&amp;p=1&amp;nq=NEW&amp;qu=as&amp;IntlSearch=&amp;boolean=PHRASE&amp;ig=01&amp;i=09&amp;i=99">as</a> '<span style="color:#8b0000;">crm:donotphone/@name</span>'
     , donotphone <a href="http://search.microsoft.com/default.asp?so=RECCNT&amp;siteid=us%2Fdev&amp;p=1&amp;nq=NEW&amp;qu=as&amp;IntlSearch=&amp;boolean=PHRASE&amp;ig=01&amp;i=09&amp;i=99">as</a> '<span style="color:#8b0000;">crm:donotphone</span>'
     , address1_shippingmethodcodename <a href="http://search.microsoft.com/default.asp?so=RECCNT&amp;siteid=us%2Fdev&amp;p=1&amp;nq=NEW&amp;qu=as&amp;IntlSearch=&amp;boolean=PHRASE&amp;ig=01&amp;i=09&amp;i=99">as</a> '<span style="color:#8b0000;">crm:address1_shippingmethodcode/@name</span>'
     , address1_shippingmethodcode <a href="http://search.microsoft.com/default.asp?so=RECCNT&amp;siteid=us%2Fdev&amp;p=1&amp;nq=NEW&amp;qu=as&amp;IntlSearch=&amp;boolean=PHRASE&amp;ig=01&amp;i=09&amp;i=99">as</a> '<span style="color:#8b0000;">crm:address1_shippingmethodcode</span>'
     , modifiedbyname <a href="http://search.microsoft.com/default.asp?so=RECCNT&amp;siteid=us%2Fdev&amp;p=1&amp;nq=NEW&amp;qu=as&amp;IntlSearch=&amp;boolean=PHRASE&amp;ig=01&amp;i=09&amp;i=99">as</a> '<span style="color:#8b0000;">crm:modifiedby/@name</span>'
     , modifiedbydsc <a href="http://search.microsoft.com/default.asp?so=RECCNT&amp;siteid=us%2Fdev&amp;p=1&amp;nq=NEW&amp;qu=as&amp;IntlSearch=&amp;boolean=PHRASE&amp;ig=01&amp;i=09&amp;i=99">as</a> '<span style="color:#8b0000;">crm:modifiedby/@dsc</span>'
     , modifiedby <a href="http://search.microsoft.com/default.asp?so=RECCNT&amp;siteid=us%2Fdev&amp;p=1&amp;nq=NEW&amp;qu=as&amp;IntlSearch=&amp;boolean=PHRASE&amp;ig=01&amp;i=09&amp;i=99">as</a> '<span style="color:#8b0000;">crm:modifiedby</span>'
     , createdbyname <a href="http://search.microsoft.com/default.asp?so=RECCNT&amp;siteid=us%2Fdev&amp;p=1&amp;nq=NEW&amp;qu=as&amp;IntlSearch=&amp;boolean=PHRASE&amp;ig=01&amp;i=09&amp;i=99">as</a> '<span style="color:#8b0000;">crm:createdby/@name</span>'
     , createdbydsc <a href="http://search.microsoft.com/default.asp?so=RECCNT&amp;siteid=us%2Fdev&amp;p=1&amp;nq=NEW&amp;qu=as&amp;IntlSearch=&amp;boolean=PHRASE&amp;ig=01&amp;i=09&amp;i=99">as</a> '<span style="color:#8b0000;">crm:createdby/@dsc</span>'
     , createdby <a href="http://search.microsoft.com/default.asp?so=RECCNT&amp;siteid=us%2Fdev&amp;p=1&amp;nq=NEW&amp;qu=as&amp;IntlSearch=&amp;boolean=PHRASE&amp;ig=01&amp;i=09&amp;i=99">as</a> '<span style="color:#8b0000;">crm:createdby</span>'
     , statuscodename <a href="http://search.microsoft.com/default.asp?so=RECCNT&amp;siteid=us%2Fdev&amp;p=1&amp;nq=NEW&amp;qu=as&amp;IntlSearch=&amp;boolean=PHRASE&amp;ig=01&amp;i=09&amp;i=99">as</a> '<span style="color:#8b0000;">crm:statuscode/@name</span>'
     , statuscode <a href="http://search.microsoft.com/default.asp?so=RECCNT&amp;siteid=us%2Fdev&amp;p=1&amp;nq=NEW&amp;qu=as&amp;IntlSearch=&amp;boolean=PHRASE&amp;ig=01&amp;i=09&amp;i=99">as</a> '<span style="color:#8b0000;">crm:statuscode</span>'
     , statecodename <a href="http://search.microsoft.com/default.asp?so=RECCNT&amp;siteid=us%2Fdev&amp;p=1&amp;nq=NEW&amp;qu=as&amp;IntlSearch=&amp;boolean=PHRASE&amp;ig=01&amp;i=09&amp;i=99">as</a> '<span style="color:#8b0000;">crm:statecode/@formattedValue</span>'
     , statecode <a href="http://search.microsoft.com/default.asp?so=RECCNT&amp;siteid=us%2Fdev&amp;p=1&amp;nq=NEW&amp;qu=as&amp;IntlSearch=&amp;boolean=PHRASE&amp;ig=01&amp;i=09&amp;i=99">as</a> '<span style="color:#8b0000;">crm:statecode</span>'
  <a href="http://search.microsoft.com/default.asp?so=RECCNT&amp;siteid=us%2Fdev&amp;p=1&amp;nq=NEW&amp;qu=FROM&amp;IntlSearch=&amp;boolean=PHRASE&amp;ig=01&amp;i=09&amp;i=99">FROM</a> Filteredaccount
   <a href="http://search.microsoft.com/default.asp?so=RECCNT&amp;siteid=us%2Fdev&amp;p=1&amp;nq=NEW&amp;qu=FOR&amp;IntlSearch=&amp;boolean=PHRASE&amp;ig=01&amp;i=09&amp;i=99">FOR</a> XML PATH ('<span style="color:#8b0000;">account</span>')</pre>
<p>The <strong>WITH XMLNAMESPACES</strong>, the field aliases and the <strong>FOR XML PATH</strong> do the magic, and we get data in this format:</p>
<pre><span style="color:#0000ff;">&lt;</span><span style="color:#800000;">account</span> <span style="color:#ff0000;">xmlns</span>:<span style="color:#ff0000;">crm</span>=<span style="color:#0000ff;">"http://schemas.microsoft.com/crm/2006/WebServices"</span> <span style="color:#ff0000;">xmlns</span>:<span style="color:#ff0000;">xsi</span>=<span style="color:#0000ff;">"http://www.w3.org/2001/XMLSchema-instance"</span> <span style="color:#ff0000;">xmlns</span>:<span style="color:#ff0000;">xsd</span>=<span style="color:#0000ff;">"http://www.w3.org/2001/XMLSchema"</span><span style="color:#0000ff;">&gt;</span>
  <span style="color:#0000ff;">&lt;</span><span style="color:#c71585;">crm</span>:<span style="color:#800000;">name</span><span style="color:#0000ff;">&gt;</span>Adventure Works Ltd.<span style="color:#0000ff;">&lt;/</span><span style="color:#c71585;">crm</span>:<span style="color:#800000;">name</span><span style="color:#0000ff;">&gt;</span>
  <span style="color:#0000ff;">&lt;</span><span style="color:#c71585;">crm</span>:<span style="color:#800000;">accountid</span><span style="color:#0000ff;">&gt;</span>E85D1177-EE17-DB11-87E4-0000E2998A6B<span style="color:#0000ff;">&lt;/</span><span style="color:#c71585;">crm</span>:<span style="color:#800000;">accountid</span><span style="color:#0000ff;">&gt;</span>
  <span style="color:#0000ff;">&lt;</span><span style="color:#c71585;">crm</span>:<span style="color:#800000;">modifiedby</span> <span style="color:#ff0000;">name</span>=<span style="color:#0000ff;">"CRM Administrator"</span> <span style="color:#ff0000;">dsc</span>=<span style="color:#0000ff;">"0"</span><span style="color:#0000ff;">&gt;</span>89A611D4-C7BD-DB11-A4E3-005056A80A71<span style="color:#0000ff;">&lt;/</span><span style="color:#c71585;">crm</span>:<span style="color:#800000;">modifiedby</span><span style="color:#0000ff;">&gt;</span>
  <span style="color:#0000ff;">&lt;</span><span style="color:#c71585;">crm</span>:<span style="color:#800000;">createdby</span> <span style="color:#ff0000;">name</span>=<span style="color:#0000ff;">"CRM Administrator"</span> <span style="color:#ff0000;">dsc</span>=<span style="color:#0000ff;">"0"</span><span style="color:#0000ff;">&gt;</span>89A611D4-C7BD-DB11-A4E3-005056A80A71<span style="color:#0000ff;">&lt;/</span><span style="color:#c71585;">crm</span>:<span style="color:#800000;">createdby</span><span style="color:#0000ff;">&gt;</span>
  <span style="color:#0000ff;">&lt;</span><span style="color:#c71585;">crm</span>:<span style="color:#800000;">statuscode</span> <span style="color:#ff0000;">name</span>=<span style="color:#0000ff;">"Active"</span><span style="color:#0000ff;">&gt;</span>1<span style="color:#0000ff;">&lt;/</span><span style="color:#c71585;">crm</span>:<span style="color:#800000;">statuscode</span><span style="color:#0000ff;">&gt;</span>
  <span style="color:#0000ff;">&lt;</span><span style="color:#c71585;">crm</span>:<span style="color:#800000;">statecode</span> <span style="color:#ff0000;">formattedValue</span>=<span style="color:#0000ff;">"Active"</span><span style="color:#0000ff;">&gt;</span>Active<span style="color:#0000ff;">&lt;/</span><span style="color:#c71585;">crm</span>:<span style="color:#800000;">statecode</span><span style="color:#0000ff;">&gt;</span>
<span style="color:#0000ff;">&lt;/</span><span style="color:#800000;">account</span><span style="color:#0000ff;">&gt;</span>
<span style="color:#0000ff;">&lt;</span><span style="color:#800000;">account</span> <span style="color:#ff0000;">xmlns</span>:<span style="color:#ff0000;">crm</span>=<span style="color:#0000ff;">"http://schemas.microsoft.com/crm/2006/WebServices"</span> <span style="color:#ff0000;">xmlns</span>:<span style="color:#ff0000;">xsi</span>=<span style="color:#0000ff;">"http://www.w3.org/2001/XMLSchema-instance"</span> <span style="color:#ff0000;">xmlns</span>:<span style="color:#ff0000;">xsd</span>=<span style="color:#0000ff;">"http://www.w3.org/2001/XMLSchema"</span><span style="color:#0000ff;">&gt;</span>
  <span style="color:#0000ff;">&lt;</span><span style="color:#c71585;">crm</span>:<span style="color:#800000;">name</span><span style="color:#0000ff;">&gt;</span>Contoso Inc.<span style="color:#0000ff;">&lt;/</span><span style="color:#c71585;">crm</span>:<span style="color:#800000;">name</span><span style="color:#0000ff;">&gt;</span>
  <span style="color:#0000ff;">&lt;</span><span style="color:#c71585;">crm</span>:<span style="color:#800000;">accountid</span><span style="color:#0000ff;">&gt;</span>A00ED7BB-9D0D-DB11-9073-000C293F9D57<span style="color:#0000ff;">&lt;/</span><span style="color:#c71585;">crm</span>:<span style="color:#800000;">accountid</span><span style="color:#0000ff;">&gt;</span>
  <span style="color:#0000ff;">&lt;</span><span style="color:#c71585;">crm</span>:<span style="color:#800000;">donotphone</span> <span style="color:#ff0000;">name</span>=<span style="color:#0000ff;">"Allow"</span><span style="color:#0000ff;">&gt;</span>0<span style="color:#0000ff;">&lt;/</span><span style="color:#c71585;">crm</span>:<span style="color:#800000;">donotphone</span><span style="color:#0000ff;">&gt;</span>
  <span style="color:#0000ff;">&lt;</span><span style="color:#c71585;">crm</span>:<span style="color:#800000;">modifiedby</span> <span style="color:#ff0000;">name</span>=<span style="color:#0000ff;">"CRM Administrator"</span> <span style="color:#ff0000;">dsc</span>=<span style="color:#0000ff;">"0"</span><span style="color:#0000ff;">&gt;</span>89A611D4-C7BD-DB11-A4E3-005056A80A71<span style="color:#0000ff;">&lt;/</span><span style="color:#c71585;">crm</span>:<span style="color:#800000;">modifiedby</span><span style="color:#0000ff;">&gt;</span>
  <span style="color:#0000ff;">&lt;</span><span style="color:#c71585;">crm</span>:<span style="color:#800000;">createdby</span> <span style="color:#ff0000;">name</span>=<span style="color:#0000ff;">"CRM Administrator"</span> <span style="color:#ff0000;">dsc</span>=<span style="color:#0000ff;">"0"</span><span style="color:#0000ff;">&gt;</span>89A611D4-C7BD-DB11-A4E3-005056A80A71<span style="color:#0000ff;">&lt;/</span><span style="color:#c71585;">crm</span>:<span style="color:#800000;">createdby</span><span style="color:#0000ff;">&gt;</span>
  <span style="color:#0000ff;">&lt;</span><span style="color:#c71585;">crm</span>:<span style="color:#800000;">statuscode</span> <span style="color:#ff0000;">name</span>=<span style="color:#0000ff;">"Active"</span><span style="color:#0000ff;">&gt;</span>1<span style="color:#0000ff;">&lt;/</span><span style="color:#c71585;">crm</span>:<span style="color:#800000;">statuscode</span><span style="color:#0000ff;">&gt;</span>
  <span style="color:#0000ff;">&lt;</span><span style="color:#c71585;">crm</span>:<span style="color:#800000;">statecode</span> <span style="color:#ff0000;">formattedValue</span>=<span style="color:#0000ff;">"Active"</span><span style="color:#0000ff;">&gt;</span>Active<span style="color:#0000ff;">&lt;/</span><span style="color:#c71585;">crm</span>:<span style="color:#800000;">statecode</span><span style="color:#0000ff;">&gt;</span>
<span style="color:#0000ff;">&lt;/</span><span style="color:#800000;">account</span><span style="color:#0000ff;">&gt;</span></pre>
<p>That is exactly what you need to obtain, with the help of XmlSerializer, a collection of accounts:</p>
<pre>XmlReader xmlReader = cmd.ExecuteXmlReader();
xmlReader.Read();

<span style="color:#0000ff;">while</span> (xmlReader.ReadState != ReadState.EndOfFile)
{
    xml = xmlReader.ReadOuterXml();
    StringReader reader = <span style="color:#0000ff;">new</span> StringReader(xml);

    account acc = serializer.Deserialize(reader) <span style="color:#0000ff;">as</span> account;
    accounts.Add(acc);
}

<span style="color:#008000;">// convert accounts in a BusinessEntitesCollection...</span></pre>
<p><strong>Note that</strong>:<br />
- the standard SQL syntax for a property is:</p>
<p align="left">, property <a href="http://search.microsoft.com/default.asp?so=RECCNT&amp;siteid=us%2Fdev&amp;p=1&amp;nq=NEW&amp;qu=as&amp;IntlSearch=&amp;boolean=PHRASE&amp;ig=01&amp;i=09&amp;i=99">as</a> &#8216;<span style="color:#8b0000;">crm:property</span>&#8216;</p>
<p>- properties expressed by CRM object model in form of &#8220;Lookup&#8221; are splitted, on the views, in three columns:</p>
<p>, property<font color="#ff0000">name</font> <a href="http://search.microsoft.com/default.asp?so=RECCNT&amp;siteid=us%2Fdev&amp;p=1&amp;nq=NEW&amp;qu=as&amp;IntlSearch=&amp;boolean=PHRASE&amp;ig=01&amp;i=09&amp;i=99">as</a> &#8216;<span style="color:#8b0000;">crm:property/@name</span>&#8216;<br />
, property<font color="#ff0000">dsc</font> <a href="http://search.microsoft.com/default.asp?so=RECCNT&amp;siteid=us%2Fdev&amp;p=1&amp;nq=NEW&amp;qu=as&amp;IntlSearch=&amp;boolean=PHRASE&amp;ig=01&amp;i=09&amp;i=99">as</a> &#8216;<span style="color:#8b0000;">crm:property/@dsc</span>&#8216;<br />
, property <a href="http://search.microsoft.com/default.asp?so=RECCNT&amp;siteid=us%2Fdev&amp;p=1&amp;nq=NEW&amp;qu=as&amp;IntlSearch=&amp;boolean=PHRASE&amp;ig=01&amp;i=09&amp;i=99">as</a> &#8216;<span style="color:#8b0000;">crm:property</span>&#8216;</p>
<p>- properties expressed by CRM object model in form of &#8220;Picklist&#8221; and &#8220;CrmBoolean&#8221; are splitted, on the views, in two columns:</p>
<p>, property<font color="#ff0000">name</font> <a href="http://search.microsoft.com/default.asp?so=RECCNT&amp;siteid=us%2Fdev&amp;p=1&amp;nq=NEW&amp;qu=as&amp;IntlSearch=&amp;boolean=PHRASE&amp;ig=01&amp;i=09&amp;i=99">as</a> &#8216;<span style="color:#8b0000;">crm:property/@name</span>&#8216;<br />
, property <a href="http://search.microsoft.com/default.asp?so=RECCNT&amp;siteid=us%2Fdev&amp;p=1&amp;nq=NEW&amp;qu=as&amp;IntlSearch=&amp;boolean=PHRASE&amp;ig=01&amp;i=09&amp;i=99">as</a> &#8216;<span style="color:#8b0000;">crm:property</span>&#8216;</p>
<p>- StatusCode and StateCode are the only further singularity.</p>
<p>Given these rules isn&#8217;t hard to build a class able to generate statements for any entity type. For an hard-core solution, add something able to translate a <strong>QueryExpression</strong> in SQL statements&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.sharpreflections.net/2007/04/06/dynamics-crm-as-development-platform-transparent-substitution-of-crmservice-with-filtered-views/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Dynamics CRM as development platform: interacting with CrmService.</title>
		<link>http://blog.sharpreflections.net/2007/03/28/dynamics-crm-as-development-platform-interacting-with-crmservice/</link>
		<comments>http://blog.sharpreflections.net/2007/03/28/dynamics-crm-as-development-platform-interacting-with-crmservice/#comments</comments>
		<pubDate>Wed, 28 Mar 2007 00:49:33 +0000</pubDate>
		<dc:creator>matteosp</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Microsoft CRM 3.0]]></category>

		<guid isPermaLink="false">http://sharpreflections.wordpress.com/2007/03/28/dynamics-crm-interacting-with-crmservice/</guid>
		<description><![CDATA[This is the first of a series of posts about extending Dynamics CRM 3.0. These posts were originally planned for some months ago, but I have had stuffs to do. Anyway, I recently restarted my activities on the product and I will share my considerations and some implementation details. Let&#8217;s start with CrmService. CrmService is [...]]]></description>
			<content:encoded><![CDATA[<p>This is the first of a series of posts about extending Dynamics CRM 3.0. These posts were originally planned for some months ago, but I have had stuffs to do. Anyway, I recently restarted my activities on the product and I will share my considerations and some implementation details. Let&#8217;s start with <a href="http://msdn2.microsoft.com/en-us/library/aa613627.aspx" title="CrmService on Dynamics CRM SDK" target="_blank">CrmService</a>. CrmService is a web service and contains the methods you need to write code against all of the entities in the system. A proxy can be obtained (with Visual Studio) adding a web reference to this url:</p>
<p align="center">http://&lt;yourservername&gt;/mscrmservices/2006/crmservice.asmx.</p>
<p>I&#8217;m not going to spend words on the web service methods, they are basically CRUD operation. The most important think is, I think, the way your code interacts with the web service. <strong>Your code shouldn&#8217;t directly use the proxy class</strong> generated by Visual Studio, is better to wrap it in a class that, just to begin, exposes the same functionalities the proxy do. Than you can start to write your code against your wrapper and, at later time, introduce enhancement in your wrapper distributing the benefits of these enhancements to all the callers of your wrapper and without modifying them. These enhancements can include:</p>
<ul>
<li><strong>Increase the performance of the HTTP/SOAP calls</strong> by implementing <a href="http://www.invokesystems.com/cs/blogs/mscrm/archive/2006/06/01/28.aspx" title="Speed Racer - Call CRM at speeds that would impress even Trixie!" target="_blank">this simple but power solution</a>. I already wrote about this, but it&#8217;s so powerful!</li>
<li>Increase the data retrieving performance by <strong>substituting web service calls with database access</strong> (on filtered views). A will dedicate an entire post to this.</li>
<li><strong>Data caching</strong>, for data that isn&#8217;t critical and doesn&#8217;t change frequently.</li>
<li>Data integrity constraints enforcement. <strong>Constraints you apply to your entity attributes are enforced only by the UI</strong>, not by the web service. But you can read those constraints from the <a href="http://msdn2.microsoft.com/en-us/library/aa682842.aspx" title="MetadataService on Dynamics CRM SDK" target="_blank">MetadataService</a> and apply them before passing data to <a href="http://msdn2.microsoft.com/en-us/library/aa613627.aspx" title="CrmService on Dynamics CRM SDK" target="_blank">CrmService</a>. May be I will write a post even on this.</li>
</ul>
<p>Here an example of how the wrapper can expose the functionalities the proxy do, with some little features&#8230;</p>
<pre><span style="color:#0000ff;">public</span> <span style="color:#0000ff;">class</span> CrmServiceClient
{
	<span style="color:#0000ff;">public</span> <span style="color:#0000ff;">virtual</span> BusinessEntity RetrieveEntity(<span style="color:#0000ff;">string</span> entityName, Guid entityId)
	{
		<span style="color:#0000ff;">return</span> RetrieveEntity(entityName, entityId, <span style="color:#0000ff;">new</span> AllColumns());
	}

	<span style="color:#0000ff;">public</span> <span style="color:#0000ff;">virtual</span> BusinessEntity RetrieveEntity(<span style="color:#0000ff;">string</span> entityName, Guid entityId, ColumnSetBase cols)
	{
		BusinessEntity entity = <span style="color:#0000ff;">null</span>;

		<span style="color:#0000ff;">try</span>
		{
			entity = m_CrmService.Retrieve(entityName, entityId, cols);
		}
		<span style="color:#0000ff;">catch</span> (SoapException ex)
		{
			LogException(ex);

			<span style="color:#0000ff;">string</span> msg = ExtractSoapExceptionMessage(ex);
			<span style="color:#0000ff;">throw</span> <span style="color:#0000ff;">new</span> Exception(msg);
		}
		<span style="color:#0000ff;">catch</span> (Exception ex)
		{
			LogException(ex);

			<span style="color:#0000ff;">throw</span>;
		}

		<span style="color:#0000ff;">return</span> entity;
	}

	<span style="color:#008000;">// other mehods...</span>
}</pre>
<p>And here the way I implemented the HTTP/SOAP calls enhancement explained in the article I linked above (note the use I make of the ConnectionGroupName property to limit the security treats that may occur by setting UnsafeAuthenticatedConnectionSharing to true):</p>
<pre><span style="color:#0000ff;">public</span> <span style="color:#0000ff;">class</span> CrmServiceClient
{
	<span style="color:#008000;">// other mehods...	</span>

	<span style="color:#0000ff;">private</span> CrmService ActivateCrmService(NetworkCredential credentials, <span style="color:#0000ff;">bool</span> unsafeAuthentication)
	{
		CrmService service = <span style="color:#0000ff;">new</span> CrmService();
		service.Credentials = credentials;

		<span style="color:#0000ff;">if</span> (unsafeAuthentication)
		{
			service.UnsafeAuthenticatedConnectionSharing = <span style="color:#0000ff;">true</span>;
			service.ConnectionGroupName = CreateSecureGroupName(credentials);
		}

		<span style="color:#0000ff;">return</span> service;
	}

	<span style="color:#0000ff;">private</span> <span style="color:#0000ff;">string</span> CreateSecureGroupName(NetworkCredential credentials)
	{
		<span style="color:#0000ff;">string</span> toEncode = credentials.UserName + credentials.Password + credentials.Domain;
		Byte[] bytes = Encoding.UTF8.GetBytes(toEncode);

		SHA1Managed Sha1 = <span style="color:#0000ff;">new</span> SHA1Managed();
		Byte[] updHash = Sha1.ComputeHash(bytes);

		<span style="color:#0000ff;">return</span> Encoding.Default.GetString(updHash);
	}
}</pre>
<p>I know there&#8217;s nothing special in these snippets, but consider this post as an intro. Something more interesting is coming soon.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.sharpreflections.net/2007/03/28/dynamics-crm-as-development-platform-interacting-with-crmservice/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Visio Shapes for Microsoft CRM 3.0</title>
		<link>http://blog.sharpreflections.net/2006/09/26/visio-shapes-for-microsoft-crm-30/</link>
		<comments>http://blog.sharpreflections.net/2006/09/26/visio-shapes-for-microsoft-crm-30/#comments</comments>
		<pubDate>Tue, 26 Sep 2006 10:17:48 +0000</pubDate>
		<dc:creator>matteosp</dc:creator>
				<category><![CDATA[Microsoft CRM 3.0]]></category>

		<guid isPermaLink="false">http://sharpreflections.wordpress.com/2006/09/26/visio-shapes-for-microsoft-crm-30/</guid>
		<description><![CDATA[Another great news from the guys from Invoke Systems:
When doing any Microsoft CRM development effort, Project Managers will need to work with our clients to gather requirements and design solutions within Microsoft CRM.  Typically a large part of this effort is to develop a Functional Design Document or Vision Document that describes exactly what [...]]]></description>
			<content:encoded><![CDATA[<p>Another great news from the guys from <a href="http://www.invokesystems.com" title="Invoke Systems" target="_blank">Invoke Systems</a>:</p>
<blockquote><p>When doing any Microsoft CRM development effort, Project Managers will need to work with our clients to gather requirements and design solutions within Microsoft CRM.  Typically a large part of this effort is to develop a Functional Design Document or Vision Document that describes exactly what we are going to build on the Microsoft CRM Platform.  These documents typically include screen mockups of what the final UI may look like. The process of creating these mockups can be very time consuming, but the results are well worth the effort.</p>
<p>To make this process easier we developed a set of 29 custom Visio shapes, that when used in conjunction with other Visio Windows XP User Interface shapes, allow our Project Managers to quickly and easily design mock CRM UI screens that meet almost any client requirement.</p></blockquote>
<p>Link: <a href="http://www.invokesystems.com/cs/blogs/mscrm/archive/2006/09/25/80.aspx" title="Invoke Systems Visio Shapes for Microsoft CRM 3.0" target="_blank">Invoke Systems Visio Shapes for Microsoft CRM 3.0</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.sharpreflections.net/2006/09/26/visio-shapes-for-microsoft-crm-30/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Link# episode 2, Microsot Dynamics CRM 3.0 related links</title>
		<link>http://blog.sharpreflections.net/2006/08/15/link_sharp_2_microsoft_crm/</link>
		<comments>http://blog.sharpreflections.net/2006/08/15/link_sharp_2_microsoft_crm/#comments</comments>
		<pubDate>Tue, 15 Aug 2006 14:35:52 +0000</pubDate>
		<dc:creator>matteosp</dc:creator>
				<category><![CDATA[Links]]></category>
		<category><![CDATA[Microsoft CRM 3.0]]></category>

		<guid isPermaLink="false">https://sharpreflections.wordpress.com/2006/08/15/link_sharp_2_microsoft_crm/</guid>
		<description><![CDATA[all about Microsot Dynamics CRM 3.0:

 Embedding Maps in CRM Forms
Let’s add a map to the CRM form in an iframe and see where they are!  This is actually really simple and all it requires is one HTML page and some changes in the form editor.

Speed Racer &#8211; Call CRM at speeds that would [...]]]></description>
			<content:encoded><![CDATA[<p>all about Microsot Dynamics CRM 3.0:</p>
<ul>
<li><a href="http://www.invokesystems.com/cs/blogs/mscrm/archive/2006/07/17/51.aspx" title=" Embedding Maps in CRM Forms" target="_blank"> Embedding Maps in CRM Forms</a><br />
<blockquote><p>Let’s add a map to the CRM form in an iframe and see where they are!  This is actually really simple and all it requires is one HTML page and some changes in the form editor.</p></blockquote>
</li>
<li><a href="http://www.invokesystems.com/cs/blogs/mscrm/archive/2006/06/01/28.aspx" title="Speed Racer - Call CRM at speeds that would impress even Trixie!" target="_blank">Speed Racer &#8211; Call CRM at speeds that would impress even Trixie!</a><br />
<blockquote><p>The other day I was doing a bit of testing to find the fastest way to make rapid calls to CRM Web Services.  The truth of the matter is that when you are calling CRM Web Services you are pretty much down to the metal; so the only places I found to make optimizations were at the .NET Web Service Request level and at the server level. The good news is that with a few very easy tweaks you can improve rapid CRM calls by almost 50%!</p></blockquote>
</li>
<li><a href="http://geekswithblogs.net/insidemscrm/archive/2006/01/28/67397.aspx" title="Getting inside Microsoft CRM - Part I" target="_blank">Getting inside Microsoft CRM &#8211; Part I</a><br />
<blockquote><p>We will write our own CRM-host to get inside CRM and get access to the internal CRM-object model at runtime. This is fairly easy.</p></blockquote>
</li>
<li><a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=bc9b3526-decf-4057-a530-91840c0d5401&amp;DisplayLang=en" title="Microsoft Dynamics CRM 3.0 List Web Part" target="_blank">Microsoft Dynamics CRM 3.0 List Web Part</a><br />
<blockquote><p>The List Web Part for Microsoft Dynamics CRM 3.0 provides a subset of the Microsoft CRM record list functionality. It allows users to view Microsoft CRM records as a list from a SharePoint dashboard, open records in Microsoft CRM 3.0 from the list, and connect Microsoft CRM Web Parts to filter different lists.</p></blockquote>
</li>
<li><a href="http://www.microsoft.com/downloads/details.aspx?familyid=18624D6F-62C6-49E4-837C-BB774CBC509C&amp;displaylang=en" title="Easy Microsoft CRM 3.0 data access using RSS" target="_blank">Easy Microsoft CRM 3.0 data access using RSS</a><br />
<blockquote><p>Learn how you can combine Microsoft CRM and RSS technologies to set up dynamic business data feeds.</p></blockquote>
</li>
</ul>
<hr size="1" width="90%" /><b>Share this post:</b>  <a href="mailto:?body=Thought%20you%20might%20like%20this:%20http://sharpreflections.wordpress.com/2006/08/15/link_sharp_2_microsoft_crm/&amp;subject=Link#%20episode%202,%20Microsot%20Dynamics%20CRM%203.0%20related%20links." title="Email Link# episode 2, Microsot Dynamics CRM 3.0 related links.">Email it!</a>   |  <a href="http://del.icio.us/post?url=http://sharpreflections.wordpress.com/2006/08/15/link_sharp_2_microsoft_crm/&amp;title=Link#%20episode%202,%20Microsot%20Dynamics%20CRM%203.0%20related%20links." target="_blank" title="Submit Link# episode 2, Microsot Dynamics CRM 3.0 related links. to del.icio.us">to del.icio.us!</a>   |   <a href="http://www.digg.com/submit?url=http://sharpreflections.wordpress.com/2006/08/15/link_sharp_2_microsoft_crm/&amp;phase=2" target="_blank" title="Submit Link# episode 2, Microsot Dynamics CRM 3.0 related links. to digg.com">digg it!</a>   |   <a href="http://reddit.com/submit?url=http://sharpreflections.wordpress.com/2006/08/15/link_sharp_2_microsoft_crm/&amp;title=Link#%20episode%202,%20Microsot%20Dynamics%20CRM%203.0%20related%20links." target="_blank" title="Submit Link# episode 2, Microsot Dynamics CRM 3.0 related links. to reddit.com">reddit!</a>  |   <a href="http://www.furl.net/storeIt.jsp?u=http://sharpreflections.wordpress.com/2006/08/15/link_sharp_2_microsoft_crm/&amp;t=Link#%20episode%202,%20Microsot%20Dynamics%20CRM%203.0%20related%20links." target="_blank" title="Link# episode 2, Microsot Dynamics CRM 3.0 related links.">Furl it!</a>  |  <a href="http://www.addtoany.com/?sitename=SharpReflections&amp;siteurl=http%3A//sharpreflections.wordpress.com/&amp;linkname=Link#%20episode%202,%20Microsot%20Dynamics%20CRM%203.0%20related%20links.&amp;linkurl=http://sharpreflections.wordpress.com/2006/08/15/link_sharp_2_microsoft_crm/&amp;type=page" target="_blank">to any service</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.sharpreflections.net/2006/08/15/link_sharp_2_microsoft_crm/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Microsoft Dynamics CRM: a development platform?</title>
		<link>http://blog.sharpreflections.net/2006/08/12/microsoft-dynamics-crm-a-development-platform/</link>
		<comments>http://blog.sharpreflections.net/2006/08/12/microsoft-dynamics-crm-a-development-platform/#comments</comments>
		<pubDate>Sat, 12 Aug 2006 00:31:10 +0000</pubDate>
		<dc:creator>matteosp</dc:creator>
				<category><![CDATA[Microsoft CRM 3.0]]></category>

		<guid isPermaLink="false">https://sharpreflections.wordpress.com/2006/08/12/microsoft-dynamics-crm-a-development-platform/</guid>
		<description><![CDATA[Dynamics CRM 3.0 is the Microsoft solution for customer management. It relies on Microsoft Server platform, it&#8217;s a web based application licensed  per-user and tightly intergrated with Office.
It supports customization in varioius way: from the simplest, as the workspace that every user can personalize or the web forms that can be edited, to the [...]]]></description>
			<content:encoded><![CDATA[<p><b>Dynamics CRM 3.0</b> is the Microsoft solution for customer management. It relies on Microsoft Server platform, it&#8217;s a web based application licensed  per-user and tightly intergrated with Office.</p>
<p>It supports customization in varioius way: from the simplest, as the workspace that every user can personalize or the web forms that can be edited, to the more sophisticated like the modifications that can be done to the <b>business logic</b> throught a relative easy-to-use graphical interface: you can edit native entities (such as Contact, Account, Case, etc&#8230;) by adding/modifyng fields and relations between entities and create your custom enties.<br />
Substantially Microsoft CRM offers you a complete and powerful <b>O/R Mapper</b> with web based interface for entities editing plus a totally automated generation process of the web forms the will operate on to complete their tasks.</p>
<p>Further more CRM exposes a web service to support software interaction: basically it allows CRUD operations to be accomplished against the appllication datasource. The great thing here is that entities you design via the application web interface are immediately exposed by the web service: the WSDL contains all the entities definitions and, if you work with Visual Studio, you can, in seconds, obtain classes representing the entities in your application domain.</p>
<p>In some cases (<a href="http://www.baselinemag.com/article2/0,1540,1972151,00.asp" title="Business Change Begins With CRM" target="_blank">take a look here</a><a href="http://blogs.msdn.com/charliew/archive/2006/04/14/576646.aspx" title="Building applications with Microsoft Dynamics CRM as a platform." target="_blank"></a>) these features lead to the assumption that Microsoft CRM can be a development platform, or, at least, part of it; and Microsoft it&#8217;s self <a href="http://blogs.msdn.com/charliew/archive/2006/04/14/576646.aspx" title="Building applications with Microsoft Dynamics CRM as a platform." target="_blank">is supporting the idea</a>. Is this a valid assumption? I think it may be. But if you are involved into the planning/design/development of an <b>Enterprise Application</b>, you must carefully evaluate what it can and what it cannot do. Some of its limits, in fact, make clear that it was not designed to be a development platform, and that this conviction emerged after it was released. I&#8217;m not saying that adopting Microsoft CRM as a development platform isn&#8217;t possible. May be is it in some cases. In making your choice you have to carefully match your requirements with what Microsoft offers and don&#8217;t offes.</p>
<p>Details like no transaction support, web service as the only channel for CRUD operations when interacting via software (only read can be run directly against the db) and the lack of a smart notifications/events system can assume, in a large application like an Enteprise one, great importance.</p>
<p>I will dedicate my next posts to analyze these limits and present my solutions to some of these.</p>
<hr size="1" width="90%" /><b>Share this post:</b><a href="mailto:?body=Thought%20you%20might%20like%20this:%20http://sharpreflections.wordpress.com/2006/08/12/microsoft-dynamics-crm-a-development-platform/&amp;subject=Microsoft%20Dynamics%20CRM:%20a%20development%20platform?" title="a development platform?">Email it!</a>   |  <a href="http://del.icio.us/post?url=http://sharpreflections.wordpress.com/2006/08/12/microsoft-dynamics-crm-a-development-platform/&amp;title=Microsoft%20Dynamics%20CRM:%20a%20development%20platform?" title="a development platform? to del.icio.us">to del.icio.us!</a>   |   <a href="http://www.digg.com/submit?url=http://sharpreflections.wordpress.com/2006/08/12/microsoft-dynamics-crm-a-development-platform/&amp;phase=2" title="a development platform? to digg.com">digg it!</a>   |   <a href="http://reddit.com/submit?url=http://sharpreflections.wordpress.com/2006/08/12/microsoft-dynamics-crm-a-development-platform/&amp;title=Microsoft%20Dynamics%20CRM:%20a%20development%20platform?" title="a development platform? to reddit.com">reddit!</a>  |   <a href="http://www.furl.net/storeIt.jsp?u=http://sharpreflections.wordpress.com/2006/08/12/microsoft-dynamics-crm-a-development-platform/&amp;t=Microsoft%20Dynamics%20CRM:%20a%20development%20platform?" target="_blank" title="a development platform?">Furl it!</a>  |  <a href="http://www.addtoany.com/?sitename=SharpReflections&amp;siteurl=http%3A//sharpreflections.wordpress.com/&amp;linkname=Microsoft%20Dynamics%20CRM:%20a%20development%20platform?&amp;linkurl=http://sharpreflections.wordpress.com/2006/08/12/microsoft-dynamics-crm-a-development-platform/&amp;type=page">To any service</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.sharpreflections.net/2006/08/12/microsoft-dynamics-crm-a-development-platform/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
