<?xml version="1.0"?><?xml-stylesheet type="text/xsl" href="http://www.codeplex.com/rss.xsl"?><rss version="2.0"><channel><title>LINQtoCRM</title><link>http://www.codeplex.com/LINQtoCRM/Project/ProjectRss.aspx</link><description>A custom LINQ queryprovider for Microsoft Dynamics CRM</description><item><title>New Post: FetchXML vs RetrieveMultiple</title><link>http://www.codeplex.com/LINQtoCRM/Thread/View.aspx?ThreadId=40393</link><description>&lt;div style="line-height: normal;"&gt;I'm fairly new to MSCRM and love the idea of using Linq to query business entities!&lt;br&gt;
The Linq queries I've written so far require about 50% less code than when I was using QueryExpression, which is great for readability/maintainability.&lt;br&gt;
&lt;br&gt;
I was just curious, why has Fetch been used instead of RetrieveMultiple?&lt;br&gt;
Are there things that can be done in FetchXML (via Stunnware's Fetch library) that can't be done using a regular CRM QueryExpression?&lt;br&gt;
Is there any significant difference in performance between the two?&lt;br&gt;
&lt;br&gt;
Cheers,&lt;br&gt;
Nathan&lt;br&gt;
&lt;/div&gt;</description><author>NathanBaulch</author><pubDate>Thu, 20 Nov 2008 22:17:49 GMT</pubDate><guid isPermaLink="false">New Post: FetchXML vs RetrieveMultiple 20081120101749P</guid></item><item><title>Source code checked in, #25212</title><link>http://www.codeplex.com/LINQtoCRM/SourceControl/ListDownloadableCommits.aspx</link><description>Better error handling. One Unit tests fails and needs updating.</description><author>friism</author><pubDate>Fri, 10 Oct 2008 10:56:09 GMT</pubDate><guid isPermaLink="false">Source code checked in, #25212 20081010105609A</guid></item><item><title>Source code checked in, #25186</title><link>http://www.codeplex.com/LINQtoCRM/SourceControl/ListDownloadableCommits.aspx</link><description>Experimental many-to-many support through CRMMetal.</description><author>friism</author><pubDate>Thu, 09 Oct 2008 13:44:56 GMT</pubDate><guid isPermaLink="false">Source code checked in, #25186 20081009014456P</guid></item><item><title>Source code checked in, #25017</title><link>http://www.codeplex.com/LINQtoCRM/SourceControl/ListDownloadableCommits.aspx</link><description>Added exception-handling for Key comparisons.</description><author>friism</author><pubDate>Sat, 04 Oct 2008 07:44:21 GMT</pubDate><guid isPermaLink="false">Source code checked in, #25017 20081004074421A</guid></item><item><title>Closed Issue: Query statecode</title><link>http://www.codeplex.com/LinqtoCRM/WorkItem/View.aspx?WorkItemId=5844</link><description>To following query fails with a nullreferenceexception&lt;br /&gt;&lt;br /&gt;var activeContacts &amp;#61; from c in provider.Linq&amp;#60;contact&amp;#62;&amp;#40;&amp;#41;&lt;br /&gt;&amp;#9;              where c.statecode.Value &amp;#61;&amp;#61; ContactState.Active&lt;br /&gt;&amp;#9;              select c&amp;#59;&lt;br /&gt;&lt;br /&gt;Apparently c.statecode.Value &amp;#40;which is an enum ContactState&amp;#41; is translated to Convert&amp;#40;c.statecode.Value&amp;#41;, which is not a memberexpression and thus line 302 &amp;#40;version 22501&amp;#41; fails&lt;br /&gt;Comments: Added by steffana in 24289</description><author>friism</author><pubDate>Mon, 15 Sep 2008 08:06:43 GMT</pubDate><guid isPermaLink="false">Closed Issue: Query statecode 20080915080643A</guid></item><item><title>Updated Wiki: Home</title><link>http://www.codeplex.com/LinqtoCRM/Wiki/View.aspx?title=Home&amp;version=53</link><description>&lt;div class="wikidoc"&gt;
&lt;h2&gt;
Introduction
&lt;/h2&gt;The Linq to CRM project provides a custom query provider for &lt;a href="http://www.microsoft.com/dynamics/crm/" class="externalLink"&gt;Microsoft Dynamics CRM&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;. Besides updating this site, I'll report progress on my nascent blog: &lt;a href="http://www.itu.dk/~friism/blog/" class="externalLink"&gt;http://www.itu.dk/~friism/blog/&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt; &lt;br /&gt;Watch the &lt;a href="http://www.itu.dk/~friism/blog/?p=37" class="externalLink"&gt;getting started tutorial&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt; (slightly outdated)&lt;br /&gt; &lt;br /&gt;Found a query you think should work, but LinqtoCRM breaks or returns the wrong data? Please create a work-item or send it to me at friism+linqtocrm@gmail.com.&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Features
&lt;/h2&gt;&lt;ul&gt;
&lt;li&gt;Where-clauses of some complexity (And/Or, greater/less-than etc.)&lt;/li&gt;&lt;li&gt;Joins through relationtionships&lt;/li&gt;&lt;li&gt;Translation of queries to FetchXML&lt;/li&gt;&lt;li&gt;Parsing of result to anonymous types or CRM entities&lt;/li&gt;&lt;li&gt;Orderby&lt;/li&gt;&lt;li&gt;Skip/Take&lt;/li&gt;&lt;li&gt;Count&lt;/li&gt;&lt;li&gt;Contains, StartsWith, EndsWith&lt;/li&gt;
&lt;/ul&gt; &lt;br /&gt;&lt;h2&gt;
Samples
&lt;/h2&gt;Setup:&lt;br /&gt;&lt;pre&gt;
            ICrmService s = new CrmWebService(new CrmService());
            s.Url = &amp;quot;http://10.0.0.3:5555/mscrmservices/2006/crmservice.asmx&amp;quot;;
            s.Credentials = new NetworkCredential(&amp;quot;username&amp;quot;, &amp;quot;password&amp;quot;, &amp;quot;domain&amp;quot;);
 
            CrmQueryProvider p = new CrmQueryProvider(s);
            p.Log = new XmlIndentingWriter(Console.Out);
&lt;/pre&gt; &lt;br /&gt; &lt;br /&gt;Retrieve CRM entity with all attributes:&lt;br /&gt;&lt;pre&gt;
            var res = from c in p.Linq&amp;lt;contact&amp;gt;()
                       select c;
&lt;/pre&gt; &lt;br /&gt; &lt;br /&gt;Retrieve anonymous type:&lt;br /&gt;&lt;pre&gt;
            var res = from c in p.Linq&amp;lt;contact&amp;gt;()
                      select new { c.fullname };
&lt;/pre&gt; &lt;br /&gt; &lt;br /&gt;Joins:&lt;br /&gt;&lt;pre&gt;
            var res = from c in p.Linq&amp;lt;contact&amp;gt;()
                      join a in p.Linq&amp;lt;account&amp;gt;()
                      on c.parentcustomerid.Value equals a.accountid.Value
                      select new { c.firstname, a.name };
&lt;/pre&gt; &lt;br /&gt; &lt;br /&gt;Contains:&lt;br /&gt;&lt;pre&gt;
            var res = from c in p.Linq&amp;lt;contact&amp;gt;()
                      where c.fullname.Contains(&amp;quot;John&amp;quot;)
                      select new { c.fullname };
&lt;/pre&gt; &lt;br /&gt; &lt;br /&gt;Count:&lt;br /&gt;&lt;pre&gt;
            int res = (from c in p.Linq&amp;lt;contact&amp;gt;()
                       select c).Count();
&lt;/pre&gt; &lt;br /&gt; &lt;br /&gt;Chained queries and paging. This query retrieves the first 100 contacts in batches of 10:&lt;br /&gt;&lt;pre&gt;
            var res = from c in p.Linq&amp;lt;contact&amp;gt;()
                      select new { c.fullname };
                       
            for (int i = 0; i &amp;lt; 10; i++)
            {
                var res2 = res.Skip(i*10).Take(10);
                foreach (var v in res2)
                    WriteLine(v.fullname);
            }
&lt;/pre&gt; &lt;br /&gt; &lt;br /&gt;Distinct&lt;br /&gt;&lt;pre&gt;
            var res = (from c in p.Linq&amp;lt;contact&amp;gt;()
                      orderby c.firstname
                      select new {  c.firstname}
                      ).Distinct();
 
&lt;/pre&gt; &lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Limitations
&lt;/h2&gt;&lt;ul&gt;
&lt;li&gt;You can only select anonymous types consisting of CRM entity attributes, like this: &lt;span class="codeInline"&gt;select new { myContact.fullname, myAccount.name }; &lt;/span&gt; or select full entities which will retrieve all attributes: &lt;span class="codeInline"&gt;from c in p.Linq&amp;lt;contact&amp;gt;() select c;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;No support for N:N relationships.&lt;/li&gt;
&lt;/ul&gt; &lt;br /&gt;&lt;h2&gt;
Status
&lt;/h2&gt;&lt;ul&gt;
&lt;li&gt;22-8-2008: &lt;a href="http://www.codeplex.com/LinqtoCRM/Release/ProjectReleases.aspx?ReleaseId=16542"&gt;0.2.7 Beta&lt;/a&gt; released&lt;/li&gt;&lt;ul&gt;
&lt;li&gt;Bug fixes by Mel Gerats&lt;/li&gt;
&lt;/ul&gt;&lt;li&gt;3-6-2008: &lt;a href="http://www.codeplex.com/LinqtoCRM/Release/ProjectReleases.aspx?ReleaseId=13994"&gt;0.2.6 Beta&lt;/a&gt; released.&lt;/li&gt;&lt;ul&gt;
&lt;li&gt;Support for Distinct&lt;/li&gt;
&lt;/ul&gt;&lt;li&gt;25-5-2008: &lt;a href="http://www.codeplex.com/LinqtoCRM/Release/ProjectReleases.aspx?ReleaseId=13737"&gt;0.2.5 Beta&lt;/a&gt; released. All new features are by Mel Gerats.&lt;/li&gt;&lt;ul&gt;
&lt;li&gt;Unit tests&lt;/li&gt;&lt;li&gt;Support for paging using Skip/Take&lt;/li&gt;&lt;li&gt;Support for Contains, StartsWith and EndsWith&lt;/li&gt;&lt;li&gt;Support for Count&lt;/li&gt;&lt;li&gt;Support for chained queries&lt;/li&gt;&lt;li&gt;Support for selecting crm entities&lt;/li&gt;&lt;li&gt;Decoupling of LinqtoCRM and web service. LinqtoCRM can be compiled to a .dll and added to project&lt;/li&gt;
&lt;/ul&gt;&lt;li&gt;13-1-2008 : &lt;a href="http://www.codeplex.com/LinqtoCRM/Release/ProjectReleases.aspx?ReleaseId=10210"&gt;0.2.4 Beta&lt;/a&gt; released.&lt;/li&gt;&lt;ul&gt;
&lt;li&gt;Bug fixes&lt;/li&gt;&lt;li&gt;Unit test project (although no tests implemented)&lt;/li&gt;&lt;li&gt;The project is fairly usable and is now in beta&lt;/li&gt;
&lt;/ul&gt;&lt;li&gt;13-1-2008 : &lt;a href="http://www.codeplex.com/LinqtoCRM/Release/ProjectReleases.aspx?ReleaseId=9869"&gt;0.2.3 Alpha&lt;/a&gt; released.&lt;/li&gt;&lt;ul&gt;
&lt;li&gt;Bug fixes&lt;/li&gt;&lt;li&gt;Now compiles out of the box -- just change web reference and you're golden.&lt;/li&gt;&lt;li&gt;Minimal download with the files you need for your project&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.itu.dk/~friism/blog/?p=37" class="externalLink"&gt;Demo video&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;li&gt;07-1-2008 : &lt;a href="http://www.codeplex.com/LinqtoCRM/Release/ProjectReleases.aspx?ReleaseId=9683"&gt;0.2.2 Alpha&lt;/a&gt; released.&lt;/li&gt;&lt;ul&gt;
&lt;li&gt;Lots of smaller bug-fixes&lt;/li&gt;&lt;li&gt;Changed from WCF to old-school service reference&lt;/li&gt;
&lt;/ul&gt;&lt;li&gt;26-12-2007 : &lt;a href="http://www.codeplex.com/LinqtoCRM/Release/ProjectReleases.aspx?ReleaseId=9433"&gt;0.2.1 Alpha&lt;/a&gt; released.&lt;/li&gt;&lt;ul&gt;
&lt;li&gt;First new release in a while, sorry 'bout that!&lt;/li&gt;&lt;li&gt;Has been compiled with VS 2008 RTM and runs against CRM 4.0 RC0 (latest VPC)&lt;/li&gt;&lt;li&gt;Updates to result-processing code from &lt;a href="http://stunnware.com/" class="externalLink"&gt;Michael H&amp;#246;hne&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;li&gt;06-08-2007 : &lt;a href="http://www.codeplex.com/LinqtoCRM/Release/ProjectReleases.aspx?ReleaseId=6263"&gt;0.2.0 Alpha&lt;/a&gt; released.&lt;/li&gt;&lt;ul&gt;
&lt;li&gt;Based on insights from Matt Warren's series of &lt;a href="http://blogs.msdn.com/mattwar/archive/2007/08/03/linq-building-an-iqueryable-provider-part-v.aspx" class="externalLink"&gt;articles&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;&lt;li&gt;Uses Visitor-pattern for query-generation&lt;/li&gt;&lt;li&gt;Ordering implemented&lt;/li&gt;&lt;li&gt;Ported to IQeryProvider/IQeryable-model&lt;/li&gt;
&lt;/ul&gt;&lt;li&gt;01-08-2007 : &lt;a href="http://www.codeplex.com/LinqtoCRM/Release/ProjectReleases.aspx?ReleaseId=6187"&gt;0.1.1 Alpha&lt;/a&gt; released. &lt;/li&gt;&lt;ul&gt;
&lt;li&gt;Compiles and runs (in it's own fashion) under VS 2008 Beta 2&lt;/li&gt;&lt;li&gt;FetchXML-library included as DLL in release (with thanks to Michael H&amp;#246;hne)&lt;/li&gt;
&lt;/ul&gt;&lt;li&gt;30-07-2007 : CodePlex site created, initial code uploaded (very crude early alpha - &lt;a href="http://www.codeplex.com/LinqtoCRM/Release/ProjectReleases.aspx?ReleaseId=6153"&gt;0.1.0 Alpha&lt;/a&gt;)&lt;/li&gt;
&lt;/ul&gt; &lt;br /&gt;&lt;h2&gt;
Todo
&lt;/h2&gt;&lt;ul&gt;
&lt;li&gt;Handle arbitrary selectors. &lt;a href="http://blogs.msdn.com/mattwar/archive/2007/08/03/linq-building-an-iqueryable-provider-part-v.aspx" class="externalLink"&gt;Matt Warren&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt; has shown how to do this but I'm having a very hard time grok'ing his implementation, even with the description on his blog. The basic idea is to look at the selector-expression and figure out where entity-attributes are actually referenced. These occurences are replaced with expressions that will evaluate correctly once the actual values have been retrieved. The code probably won't get as complex as Matt's because FetchXML is considerably less expressive than SQL and we can give up earlier.&lt;/li&gt;&lt;li&gt;A visual debugger/visualizer to show were you've been too ambitious with your query. Bart De Smet seems to have the right &lt;a href="http://community.bartdesmet.net/blogs/linqtosharepoint/archive/2007/07/05/linq-to-sharepoint-improving-the-parser-debugger-visualizer-fun.aspx" class="externalLink"&gt;idea&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;&lt;li&gt;A &amp;quot;pedal-to-the-metal&amp;quot; toggle. If the code will be running with acess to the SQL-server, the developer can specify that the query should be translated to SQL and run on the filtered views at the flick of a switch.&lt;/li&gt;&lt;li&gt;The CRM web service is tangled up in the queryprovider code. It would be desirable if it could be moved outside and accessed though an interface. The code is rather dependent on the types exposed by the web service proxy-classes and it is not clear how this dependency could be removed without implementing something along the lines of SQLMetal/SPMetal.&lt;/li&gt;&lt;ul&gt;
&lt;li&gt;Support for N:N could be a part of this effort. See discussion here: &lt;a href="http://www.codeplex.com/LinqtoCRM/WorkItem/View.aspx?WorkItemId=4709" class="externalLink"&gt;http://www.codeplex.com/LinqtoCRM/WorkItem/View.aspx?WorkItemId=4709&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/ul&gt; &lt;br /&gt;&lt;h2&gt;
Credits
&lt;/h2&gt;&lt;ul&gt;
&lt;li&gt;Mel Gerats for implementing paging, contains and loads of other stuff&lt;/li&gt;&lt;li&gt;Bart De Smet for the inspirational &lt;a href="http://www.codeplex.com/LINQtoSharePoint" class="externalLink"&gt;LINQtoSharePoint&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt; implementation&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.stunnware.com/crm/" class="externalLink"&gt;Michael H&amp;#246;hne&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt; for his FetchXML library&lt;/li&gt;&lt;li&gt;Matt Warren for his articles on QueryProvider-building: &lt;a href="http://blogs.msdn.com/mattwar/archive/2007/08/03/linq-building-an-iqueryable-provider-part-v.aspx" class="externalLink"&gt;http://blogs.msdn.com/mattwar/archive/2007/08/03/linq-building-an-iqueryable-provider-part-v.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;</description><author>friism</author><pubDate>Sun, 14 Sep 2008 19:34:08 GMT</pubDate><guid isPermaLink="false">Updated Wiki: Home 20080914073408P</guid></item><item><title>Source code checked in, #24289</title><link>http://www.codeplex.com/LinqtoCRM/SourceControl/ListDownloadableCommits.aspx</link><description>Removed scc files</description><author>friism</author><pubDate>Sun, 14 Sep 2008 19:29:38 GMT</pubDate><guid isPermaLink="false">Source code checked in, #24289 20080914072938P</guid></item><item><title>Source code checked in, #24287</title><link>http://www.codeplex.com/LinqtoCRM/SourceControl/ListDownloadableCommits.aspx</link><description>merged latest updates from staffana</description><author>friism</author><pubDate>Sun, 14 Sep 2008 18:55:45 GMT</pubDate><guid isPermaLink="false">Source code checked in, #24287 20080914065545P</guid></item><item><title>Commented Issue: Where clauses on linked entity attributes fail</title><link>http://www.codeplex.com/LinqtoCRM/WorkItem/View.aspx?WorkItemId=5390</link><description>&amp;#91;Reported my mraufer&amp;#93;&lt;br /&gt;This query fails&amp;#58;&lt;br /&gt;var contacts &amp;#61; from c in provider.Linq&amp;#60;contact&amp;#62;&amp;#40;&amp;#41;&lt;br /&gt;                           join a in provider.Linq&amp;#60;account&amp;#62;&amp;#40;&amp;#41;&lt;br /&gt;                           on c.parentcustomerid.Value equals a.accountid.Value&lt;br /&gt;                           where a.name.Contains&amp;#40;&amp;#34;Sports&amp;#34;&amp;#41;&lt;br /&gt;                           select c&amp;#59;&lt;br /&gt;&lt;br /&gt;The reason is that LinqtoCRM always creates filters on the root entity.&lt;br /&gt;Comments: ** Comment from web user: wesweeks ** &lt;p&gt;&lt;br /&gt;Need to amend this.  the problem occurs is there is more the one criteria in the where clause.  This fails as well&amp;#58;&lt;/p&gt;&lt;p&gt;var res &amp;#61; &amp;#40;from a in queryProvider.Linq&amp;#60;opportunity&amp;#62;&amp;#40;&amp;#41;&lt;br /&gt;join b in queryProvider.Linq&amp;#60;contact&amp;#62;&amp;#40;&amp;#41;&lt;br /&gt;on a.customerid.Value equals b.contactid.Value&lt;br /&gt;where b.firstname&amp;#61;&amp;#61; &amp;#34;name&amp;#34; &amp;#38;&amp;#38;&lt;br /&gt;b.emailaddress1 &amp;#61;&amp;#61; &amp;#34;my&amp;#64;email.com&amp;#34;&lt;br /&gt;select a&amp;#41;&amp;#59;&lt;br /&gt;&lt;/p&gt;</description><author>wesweeks</author><pubDate>Fri, 12 Sep 2008 12:31:14 GMT</pubDate><guid isPermaLink="false">Commented Issue: Where clauses on linked entity attributes fail 20080912123114P</guid></item><item><title>Commented Issue: Where clauses on linked entity attributes fail</title><link>http://www.codeplex.com/LinqtoCRM/WorkItem/View.aspx?WorkItemId=5390</link><description>&amp;#91;Reported my mraufer&amp;#93;&lt;br /&gt;This query fails&amp;#58;&lt;br /&gt;var contacts &amp;#61; from c in provider.Linq&amp;#60;contact&amp;#62;&amp;#40;&amp;#41;&lt;br /&gt;                           join a in provider.Linq&amp;#60;account&amp;#62;&amp;#40;&amp;#41;&lt;br /&gt;                           on c.parentcustomerid.Value equals a.accountid.Value&lt;br /&gt;                           where a.name.Contains&amp;#40;&amp;#34;Sports&amp;#34;&amp;#41;&lt;br /&gt;                           select c&amp;#59;&lt;br /&gt;&lt;br /&gt;The reason is that LinqtoCRM always creates filters on the root entity.&lt;br /&gt;Comments: ** Comment from web user: wesweeks ** &lt;p&gt;Not working properly if where clause searches on data from both entities&lt;/p&gt;&lt;p&gt;var res &amp;#61; &amp;#40;from a in queryProvider.Linq&amp;#60;opportunity&amp;#62;&amp;#40;&amp;#41;&lt;br /&gt;                       join b in queryProvider.Linq&amp;#60;contact&amp;#62;&amp;#40;&amp;#41;&lt;br /&gt;                       on a.customerid.Value equals b.contactid.Value&lt;br /&gt;                       where  a.name&amp;#61;&amp;#61; &amp;#34;name&amp;#34; &amp;#38;&amp;#38;&lt;br /&gt;                       b.emailaddress1 &amp;#61;&amp;#61; &amp;#34;my&amp;#64;email.com&amp;#34;&lt;br /&gt;                       select a&amp;#41;&amp;#59;&lt;br /&gt;you get the error &lt;br /&gt;&amp;#92;0x80041103  &amp;#39;Opportunity&amp;#39; entity doesn&amp;#39;t contain attribute with Name &amp;#61; &amp;#39;emailaddress1&amp;#39;.&lt;/p&gt;&lt;p&gt;The fetch XMl looks like this&amp;#58;&lt;br /&gt;&amp;#60;fetch mapping&amp;#61;&amp;#34;logical&amp;#34;&amp;#62;&lt;br /&gt;&amp;#9;&amp;#60;entity name&amp;#61;&amp;#34;opportunity&amp;#34;&amp;#62;&lt;br /&gt;&amp;#9;&amp;#9;&amp;#60;all-attributes &amp;#47;&amp;#62;&lt;br /&gt;&amp;#9;&amp;#9;&amp;#60;filter&amp;#62;&lt;br /&gt;&amp;#9;&amp;#9;&amp;#9;&amp;#60;condition attribute&amp;#61;&amp;#34;name&amp;#34; operator&amp;#61;&amp;#34;eq&amp;#34; value&amp;#61;&amp;#34;name&amp;#34; &amp;#47;&amp;#62;&lt;br /&gt;&amp;#9;&amp;#9;&amp;#9;&amp;#60;condition attribute&amp;#61;&amp;#34;emailaddress1&amp;#34; operator&amp;#61;&amp;#34;eq&amp;#34; value&amp;#61;&amp;#34;my&amp;#64;email.com&amp;#34; &amp;#47;&amp;#62;&lt;br /&gt;&amp;#9;&amp;#9;&amp;#60;&amp;#47;filter&amp;#62;&lt;br /&gt;&amp;#9;&amp;#9;&amp;#60;link-entity name&amp;#61;&amp;#34;contact&amp;#34; from&amp;#61;&amp;#34;contactid&amp;#34; to&amp;#61;&amp;#34;customerid&amp;#34; &amp;#47;&amp;#62;&lt;br /&gt;&amp;#9;&amp;#60;&amp;#47;entity&amp;#62;&lt;br /&gt;&amp;#60;&amp;#47;fetch&amp;#62;&lt;/p&gt;&lt;p&gt;So it goes back to the root entity only if the where specifies search critieria from both.  I can specify for one entity or the other and it will work but would be very helpful to be able to do both.&lt;/p&gt;</description><author>wesweeks</author><pubDate>Fri, 12 Sep 2008 12:21:04 GMT</pubDate><guid isPermaLink="false">Commented Issue: Where clauses on linked entity attributes fail 20080912122104P</guid></item><item><title>Commented Issue: Query statecode</title><link>http://www.codeplex.com/LinqtoCRM/WorkItem/View.aspx?WorkItemId=5844</link><description>To following query fails with a nullreferenceexception&lt;br /&gt;&lt;br /&gt;var activeContacts &amp;#61; from c in provider.Linq&amp;#60;contact&amp;#62;&amp;#40;&amp;#41;&lt;br /&gt;&amp;#9;              where c.statecode.Value &amp;#61;&amp;#61; ContactState.Active&lt;br /&gt;&amp;#9;              select c&amp;#59;&lt;br /&gt;&lt;br /&gt;Apparently c.statecode.Value &amp;#40;which is an enum ContactState&amp;#41; is translated to Convert&amp;#40;c.statecode.Value&amp;#41;, which is not a memberexpression and thus line 302 &amp;#40;version 22501&amp;#41; fails&lt;br /&gt;Comments: ** Comment from web user: steffana ** &lt;p&gt;I fixed this issue by changing line 302 &amp;#40;v.22501&amp;#41; to&amp;#58;&lt;/p&gt;&lt;p&gt;MemberExpression mexp &amp;#61; &amp;#40;&amp;#40;b.Left is UnaryExpression&amp;#41; &amp;#63; &amp;#40;b.Left as UnaryExpression&amp;#41;.Operand &amp;#58; b.Left&amp;#41; as MemberExpression&amp;#59;&lt;/p&gt;&lt;p&gt;such that is uses the operand as attritute is Left expression is unary &amp;#40;e.g. Convert&amp;#41;&lt;br /&gt;&lt;/p&gt;</description><author>steffana</author><pubDate>Tue, 02 Sep 2008 09:14:09 GMT</pubDate><guid isPermaLink="false">Commented Issue: Query statecode 20080902091409A</guid></item><item><title>Commented Issue: Where clause with dates</title><link>http://www.codeplex.com/LinqtoCRM/WorkItem/View.aspx?WorkItemId=5818</link><description>I needed to write a query like&lt;br /&gt;&lt;br /&gt;var query &amp;#61; from c in provider.Linq&amp;#60;contact&amp;#62;&amp;#40;&amp;#41;&lt;br /&gt;               where c.createdon.UserTime &amp;#60;&amp;#61; DateTime.Now&lt;br /&gt;               select new &amp;#123; c.fullname &amp;#125;&lt;br /&gt;&lt;br /&gt;Using &amp;#34;where c.createdon.Value &amp;#60;&amp;#61; DateTime.ToString&amp;#40;&amp;#34;s&amp;#34;&amp;#41;&amp;#34; does not work as less or equal is not a valid string operator.&lt;br /&gt;I solved the problem by implementing a small fix in SetConditionValue in QueryFormatter.cs&lt;br /&gt;&lt;br /&gt;private void SetConditionalValues&amp;#40;FetchCondition cond, BinaryExpression b&amp;#41;&lt;br /&gt;&amp;#123;&lt;br /&gt;&amp;#9;MemberExpression mexp &amp;#61; b.Left as MemberExpression&amp;#59;&lt;br /&gt;&amp;#9;MemberExpression pmexp &amp;#61; mexp.Expression as MemberExpression&amp;#59;&lt;br /&gt;&lt;br /&gt;&amp;#47;&amp;#47; Changes this if, to go a level deeper anytime the member AND the parent member is a property &amp;#40;e.g. c.status.Value or c.createdon.UserTime&amp;#41;&lt;br /&gt;&amp;#47;&amp;#47; Previous version only did this for Value-property&lt;br /&gt;&amp;#9;if &amp;#40;mexp.Member.MemberType.Equals&amp;#40;MemberTypes.Property&amp;#41; &amp;#38;&amp;#38; pmexp &amp;#33;&amp;#61; null &amp;#38;&amp;#38; pmexp.Member.MemberType.Equals&amp;#40;MemberTypes.Property&amp;#41;&amp;#41;&lt;br /&gt;&amp;#9;&amp;#123;&lt;br /&gt;&amp;#9;&amp;#9;&amp;#47;&amp;#47; need to go one level deeper&lt;br /&gt;&amp;#9;&amp;#9;cond.Attribute &amp;#61; &amp;#40;mexp.Expression as MemberExpression&amp;#41;.Member.Name&amp;#59;&lt;br /&gt;&amp;#9;&amp;#125;&lt;br /&gt;&amp;#9;else&lt;br /&gt;&amp;#9;&amp;#123;&lt;br /&gt;&amp;#9;&amp;#9;cond.Attribute &amp;#61; mexp.Member.Name&amp;#59;&lt;br /&gt;&amp;#9;&amp;#125;&lt;br /&gt;&amp;#9;&lt;br /&gt;&amp;#9;object value &amp;#61; Expression.Lambda&amp;#40;b.Right&amp;#41;.Compile&amp;#40;&amp;#41;.DynamicInvoke&amp;#40;&amp;#41;&amp;#59;&lt;br /&gt;&amp;#9;&amp;#47;&amp;#47; check for null comparison&lt;br /&gt;&amp;#9;if &amp;#40;value &amp;#61;&amp;#61; null&amp;#41;&lt;br /&gt;&amp;#9;&amp;#123;&lt;br /&gt;&amp;#9;&amp;#9;if &amp;#40;cond.ConditionOperator &amp;#61;&amp;#61; FetchConditionOperator.Equal&amp;#41;&lt;br /&gt;&amp;#9;&amp;#9;&amp;#9;cond.ConditionOperator &amp;#61; FetchConditionOperator.Null&amp;#59;&lt;br /&gt;&amp;#9;&amp;#9;else if &amp;#40;cond.ConditionOperator &amp;#61;&amp;#61; FetchConditionOperator.NotEqual&amp;#41;&lt;br /&gt;&amp;#9;&amp;#9;&amp;#9;cond.ConditionOperator &amp;#61; FetchConditionOperator.NotNull&amp;#59;&lt;br /&gt;&amp;#9;&amp;#9;else&lt;br /&gt;&amp;#9;&amp;#9;&amp;#9;throw new Exception&amp;#40;&amp;#34;Strange null-comparison&amp;#34;&amp;#41;&amp;#59;&lt;br /&gt;&amp;#9;&amp;#125;&lt;br /&gt;&amp;#9;else&lt;br /&gt;&amp;#9;&amp;#123;&lt;br /&gt;&amp;#9;&amp;#9;if &amp;#40;value is DateTime&amp;#41;&lt;br /&gt;&amp;#9;&amp;#9;&amp;#123;&lt;br /&gt;&amp;#47;&amp;#47; If the value to compare to is of type DateTime, format it in a way fetchXml will accept&lt;br /&gt;&amp;#9;&amp;#9;&amp;#9;cond.Values.Add&amp;#40;&amp;#40;&amp;#40;DateTime&amp;#41;value&amp;#41;.ToString&amp;#40;&amp;#34;s&amp;#34;&amp;#41;&amp;#41;&amp;#59;&lt;br /&gt;&amp;#9;&amp;#9;&amp;#125;&lt;br /&gt;&amp;#9;&amp;#9;else&lt;br /&gt;&amp;#9;&amp;#9;&amp;#123;&lt;br /&gt;&amp;#9;&amp;#9;&amp;#9;cond.Values.Add&amp;#40;value&amp;#41;&amp;#59;&lt;br /&gt;&amp;#9;&amp;#9;&amp;#125;&lt;br /&gt;&amp;#9;&amp;#125;&lt;br /&gt;&amp;#125;&lt;br /&gt;Comments: ** Comment from web user: steffana ** &lt;p&gt;In order not to mess up where clauses on linked entites, the following line&amp;#58;&lt;br /&gt;if &amp;#40;mexp.Member.MemberType.Equals&amp;#40;MemberTypes.Property&amp;#41; &amp;#38;&amp;#38; pmexp &amp;#33;&amp;#61; null &amp;#38;&amp;#38; pmexp.Member.MemberType.Equals&amp;#40;MemberTypes.Property&amp;#41;&amp;#41;&lt;/p&gt;&lt;p&gt;should be extended to&amp;#58;&lt;br /&gt;if &amp;#40;mexp.Member.MemberType.Equals&amp;#40;MemberTypes.Property&amp;#41; &amp;#38;&amp;#38; pmexp &amp;#33;&amp;#61; null &amp;#38;&amp;#38; pmexp.Member.MemberType.Equals&amp;#40;MemberTypes.Property&amp;#41; &amp;#38;&amp;#38; pmexp.Type.BaseType.Name &amp;#33;&amp;#61; &amp;#34;BusinessEntity&amp;#34;&amp;#41;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;</description><author>steffana</author><pubDate>Tue, 02 Sep 2008 09:04:12 GMT</pubDate><guid isPermaLink="false">Commented Issue: Where clause with dates 20080902090412A</guid></item><item><title>Created Issue: Query statecode</title><link>http://www.codeplex.com/LinqtoCRM/WorkItem/View.aspx?WorkItemId=5844</link><description>To following query fails with a nullreferenceexception&lt;br /&gt;&lt;br /&gt;var activeContacts &amp;#61; from c in provider.Linq&amp;#60;contact&amp;#62;&amp;#40;&amp;#41;&lt;br /&gt;&amp;#9;              where c.statecode.Value &amp;#61;&amp;#61; ContactState.Active&lt;br /&gt;&amp;#9;              select c&amp;#59;&lt;br /&gt;&lt;br /&gt;Apparently c.statecode.Value &amp;#40;which is an enum ContactState&amp;#41; is translated to Convert&amp;#40;c.statecode.Value&amp;#41;, which is not a memberexpression and thus line 302 &amp;#40;version 22501&amp;#41; fails&lt;br /&gt;</description><author>steffana</author><pubDate>Wed, 27 Aug 2008 12:06:53 GMT</pubDate><guid isPermaLink="false">Created Issue: Query statecode 20080827120653P</guid></item><item><title>Created Issue: Where clause with dates</title><link>http://www.codeplex.com/LinqtoCRM/WorkItem/View.aspx?WorkItemId=5818</link><description>I needed to write a query like&lt;br /&gt;&lt;br /&gt;var query &amp;#61; from c in provider.Linq&amp;#60;contact&amp;#62;&amp;#40;&amp;#41;&lt;br /&gt;               where c.createdon.UserTime &amp;#60;&amp;#61; DateTime.Now&lt;br /&gt;               select new &amp;#123; c.fullname &amp;#125;&lt;br /&gt;&lt;br /&gt;Using &amp;#34;where c.createdon.Value &amp;#60;&amp;#61; DateTime.ToString&amp;#40;&amp;#34;s&amp;#34;&amp;#41;&amp;#34; does not work as less or equal is not a valid string operator.&lt;br /&gt;I solved the problem by implementing a small fix in SetConditionValue in QueryFormatter.cs&lt;br /&gt;&lt;br /&gt;private void SetConditionalValues&amp;#40;FetchCondition cond, BinaryExpression b&amp;#41;&lt;br /&gt;&amp;#123;&lt;br /&gt;&amp;#9;MemberExpression mexp &amp;#61; b.Left as MemberExpression&amp;#59;&lt;br /&gt;&amp;#9;MemberExpression pmexp &amp;#61; mexp.Expression as MemberExpression&amp;#59;&lt;br /&gt;&lt;br /&gt;&amp;#47;&amp;#47; Changes this if, to go a level deeper anytime the member AND the parent member is a property &amp;#40;e.g. c.status.Value or c.createdon.UserTime&amp;#41;&lt;br /&gt;&amp;#47;&amp;#47; Previous version only did this for Value-property&lt;br /&gt;&amp;#9;if &amp;#40;mexp.Member.MemberType.Equals&amp;#40;MemberTypes.Property&amp;#41; &amp;#38;&amp;#38; pmexp &amp;#33;&amp;#61; null &amp;#38;&amp;#38; pmexp.Member.MemberType.Equals&amp;#40;MemberTypes.Property&amp;#41;&amp;#41;&lt;br /&gt;&amp;#9;&amp;#123;&lt;br /&gt;&amp;#9;&amp;#9;&amp;#47;&amp;#47; need to go one level deeper&lt;br /&gt;&amp;#9;&amp;#9;cond.Attribute &amp;#61; &amp;#40;mexp.Expression as MemberExpression&amp;#41;.Member.Name&amp;#59;&lt;br /&gt;&amp;#9;&amp;#125;&lt;br /&gt;&amp;#9;else&lt;br /&gt;&amp;#9;&amp;#123;&lt;br /&gt;&amp;#9;&amp;#9;cond.Attribute &amp;#61; mexp.Member.Name&amp;#59;&lt;br /&gt;&amp;#9;&amp;#125;&lt;br /&gt;&amp;#9;&lt;br /&gt;&amp;#9;object value &amp;#61; Expression.Lambda&amp;#40;b.Right&amp;#41;.Compile&amp;#40;&amp;#41;.DynamicInvoke&amp;#40;&amp;#41;&amp;#59;&lt;br /&gt;&amp;#9;&amp;#47;&amp;#47; check for null comparison&lt;br /&gt;&amp;#9;if &amp;#40;value &amp;#61;&amp;#61; null&amp;#41;&lt;br /&gt;&amp;#9;&amp;#123;&lt;br /&gt;&amp;#9;&amp;#9;if &amp;#40;cond.ConditionOperator &amp;#61;&amp;#61; FetchConditionOperator.Equal&amp;#41;&lt;br /&gt;&amp;#9;&amp;#9;&amp;#9;cond.ConditionOperator &amp;#61; FetchConditionOperator.Null&amp;#59;&lt;br /&gt;&amp;#9;&amp;#9;else if &amp;#40;cond.ConditionOperator &amp;#61;&amp;#61; FetchConditionOperator.NotEqual&amp;#41;&lt;br /&gt;&amp;#9;&amp;#9;&amp;#9;cond.ConditionOperator &amp;#61; FetchConditionOperator.NotNull&amp;#59;&lt;br /&gt;&amp;#9;&amp;#9;else&lt;br /&gt;&amp;#9;&amp;#9;&amp;#9;throw new Exception&amp;#40;&amp;#34;Strange null-comparison&amp;#34;&amp;#41;&amp;#59;&lt;br /&gt;&amp;#9;&amp;#125;&lt;br /&gt;&amp;#9;else&lt;br /&gt;&amp;#9;&amp;#123;&lt;br /&gt;&amp;#9;&amp;#9;if &amp;#40;value is DateTime&amp;#41;&lt;br /&gt;&amp;#9;&amp;#9;&amp;#123;&lt;br /&gt;&amp;#47;&amp;#47; If the value to compare to is of type DateTime, format it in a way fetchXml will accept&lt;br /&gt;&amp;#9;&amp;#9;&amp;#9;cond.Values.Add&amp;#40;&amp;#40;&amp;#40;DateTime&amp;#41;value&amp;#41;.ToString&amp;#40;&amp;#34;s&amp;#34;&amp;#41;&amp;#41;&amp;#59;&lt;br /&gt;&amp;#9;&amp;#9;&amp;#125;&lt;br /&gt;&amp;#9;&amp;#9;else&lt;br /&gt;&amp;#9;&amp;#9;&amp;#123;&lt;br /&gt;&amp;#9;&amp;#9;&amp;#9;cond.Values.Add&amp;#40;value&amp;#41;&amp;#59;&lt;br /&gt;&amp;#9;&amp;#9;&amp;#125;&lt;br /&gt;&amp;#9;&amp;#125;&lt;br /&gt;&amp;#125;&lt;br /&gt;</description><author>steffana</author><pubDate>Mon, 25 Aug 2008 12:03:45 GMT</pubDate><guid isPermaLink="false">Created Issue: Where clause with dates 20080825120345P</guid></item><item><title>Updated Wiki: Home</title><link>http://www.codeplex.com/LinqtoCRM/Wiki/View.aspx?title=Home&amp;version=52</link><description>&lt;div class="wikidoc"&gt;
&lt;h2&gt;
Introduction
&lt;/h2&gt;The Linq to CRM project provides a custom query provider for &lt;a href="http://www.microsoft.com/dynamics/crm/" class="externalLink"&gt;Microsoft Dynamics CRM&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;. Besides updating this site, I'll report progress on my nascent blog: &lt;a href="http://www.itu.dk/~friism/blog/" class="externalLink"&gt;http://www.itu.dk/~friism/blog/&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt; &lt;br /&gt;Watch the &lt;a href="http://www.itu.dk/~friism/blog/?p=37" class="externalLink"&gt;getting started tutorial&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt; (slightly outdated)&lt;br /&gt; &lt;br /&gt;Found a query you think should work, but LinqtoCRM breaks or returns the wrong data? Please create a work-item or send it to me at friism+linqtocrm@gmail.com.&lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Features
&lt;/h2&gt;&lt;ul&gt;
&lt;li&gt;Where-clauses of some complexity (And/Or, greater/less-than etc.)&lt;/li&gt;&lt;li&gt;Joins through relationtionships&lt;/li&gt;&lt;li&gt;Translation of queries to FetchXML&lt;/li&gt;&lt;li&gt;Parsing of result to anonymous types or CRM entities&lt;/li&gt;&lt;li&gt;Orderby&lt;/li&gt;&lt;li&gt;Skip/Take&lt;/li&gt;&lt;li&gt;Count&lt;/li&gt;&lt;li&gt;Contains, StartsWith, EndsWith&lt;/li&gt;
&lt;/ul&gt; &lt;br /&gt;&lt;h2&gt;
Samples
&lt;/h2&gt;Setup:&lt;br /&gt;&lt;pre&gt;
            ICrmService s = new CrmWebService(new CrmService());
            s.Url = &amp;quot;http://10.0.0.3:5555/mscrmservices/2006/crmservice.asmx&amp;quot;;
            s.Credentials = new NetworkCredential(&amp;quot;username&amp;quot;, &amp;quot;password&amp;quot;, &amp;quot;domain&amp;quot;);
 
            CrmQueryProvider p = new CrmQueryProvider(s);
            p.Log = new XmlIndentingWriter(Console.Out);
&lt;/pre&gt; &lt;br /&gt; &lt;br /&gt;Retrieve CRM entity with all attributes:&lt;br /&gt;&lt;pre&gt;
            var res = from c in p.Linq&amp;lt;contact&amp;gt;()
                       select c;
&lt;/pre&gt; &lt;br /&gt; &lt;br /&gt;Retrieve anonymous type:&lt;br /&gt;&lt;pre&gt;
            var res = from c in p.Linq&amp;lt;contact&amp;gt;()
                      select new { c.fullname };
&lt;/pre&gt; &lt;br /&gt; &lt;br /&gt;Joins:&lt;br /&gt;&lt;pre&gt;
            var res = from c in p.Linq&amp;lt;contact&amp;gt;()
                      join a in p.Linq&amp;lt;account&amp;gt;()
                      on c.parentcustomerid.Value equals a.accountid.Value
                      select new { c.firstname, a.name };
&lt;/pre&gt; &lt;br /&gt; &lt;br /&gt;Contains:&lt;br /&gt;&lt;pre&gt;
            var res = from c in p.Linq&amp;lt;contact&amp;gt;()
                      where c.fullname.Contains(&amp;quot;John&amp;quot;)
                      select new { c.fullname };
&lt;/pre&gt; &lt;br /&gt; &lt;br /&gt;Count:&lt;br /&gt;&lt;pre&gt;
            int res = (from c in p.Linq&amp;lt;contact&amp;gt;()
                       select c).Count();
&lt;/pre&gt; &lt;br /&gt; &lt;br /&gt;Chained queries and paging. This query retrieves the first 100 contacts in batches of 10:&lt;br /&gt;&lt;pre&gt;
            var res = from c in p.Linq&amp;lt;contact&amp;gt;()
                      select new { c.fullname };
                       
            for (int i = 0; i &amp;lt; 10; i++)
            {
                var res2 = res.Skip(i*10).Take(10);
                foreach (var v in res2)
                    WriteLine(v.fullname);
            }
&lt;/pre&gt; &lt;br /&gt; &lt;br /&gt;Distinct&lt;br /&gt;&lt;pre&gt;
            var res = (from c in p.Linq&amp;lt;contact&amp;gt;()
                      orderby c.firstname
                      select new {  c.firstname}
                      ).Distinct();
 
&lt;/pre&gt; &lt;br /&gt; &lt;br /&gt;&lt;h2&gt;
Limitations
&lt;/h2&gt;&lt;ul&gt;
&lt;li&gt;You can only select anonymous types consisting of CRM entity attributes, like this: &lt;span class="codeInline"&gt;select new { myContact.fullname, myAccount.name }; &lt;/span&gt; or select full entities which will retrieve all attributes: &lt;span class="codeInline"&gt;from c in p.Linq&amp;lt;contact&amp;gt;() select c;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;No support for N:N relationships.&lt;/li&gt;
&lt;/ul&gt; &lt;br /&gt;&lt;h2&gt;
Status
&lt;/h2&gt;&lt;ul&gt;
&lt;li&gt;22-8-2008: &lt;a href="http://www.codeplex.com/LinqtoCRM/Release/ProjectReleases.aspx?ReleaseId=16542"&gt;0.2.7 Beta&lt;/a&gt; released&lt;/li&gt;&lt;ul&gt;
&lt;li&gt;Bug fixes&lt;/li&gt;
&lt;/ul&gt;&lt;li&gt;3-6-2008: &lt;a href="http://www.codeplex.com/LinqtoCRM/Release/ProjectReleases.aspx?ReleaseId=13994"&gt;0.2.6 Beta&lt;/a&gt; released.&lt;/li&gt;&lt;ul&gt;
&lt;li&gt;Support for Distinct&lt;/li&gt;
&lt;/ul&gt;&lt;li&gt;25-5-2008: &lt;a href="http://www.codeplex.com/LinqtoCRM/Release/ProjectReleases.aspx?ReleaseId=13737"&gt;0.2.5 Beta&lt;/a&gt; released. All new features are by Mel Gerats.&lt;/li&gt;&lt;ul&gt;
&lt;li&gt;Unit tests&lt;/li&gt;&lt;li&gt;Support for paging using Skip/Take&lt;/li&gt;&lt;li&gt;Support for Contains, StartsWith and EndsWith&lt;/li&gt;&lt;li&gt;Support for Count&lt;/li&gt;&lt;li&gt;Support for chained queries&lt;/li&gt;&lt;li&gt;Support for selecting crm entities&lt;/li&gt;&lt;li&gt;Decoupling of LinqtoCRM and web service. LinqtoCRM can be compiled to a .dll and added to project&lt;/li&gt;
&lt;/ul&gt;&lt;li&gt;13-1-2008 : &lt;a href="http://www.codeplex.com/LinqtoCRM/Release/ProjectReleases.aspx?ReleaseId=10210"&gt;0.2.4 Beta&lt;/a&gt; released.&lt;/li&gt;&lt;ul&gt;
&lt;li&gt;Bug fixes&lt;/li&gt;&lt;li&gt;Unit test project (although no tests implemented)&lt;/li&gt;&lt;li&gt;The project is fairly usable and is now in beta&lt;/li&gt;
&lt;/ul&gt;&lt;li&gt;13-1-2008 : &lt;a href="http://www.codeplex.com/LinqtoCRM/Release/ProjectReleases.aspx?ReleaseId=9869"&gt;0.2.3 Alpha&lt;/a&gt; released.&lt;/li&gt;&lt;ul&gt;
&lt;li&gt;Bug fixes&lt;/li&gt;&lt;li&gt;Now compiles out of the box -- just change web reference and you're golden.&lt;/li&gt;&lt;li&gt;Minimal download with the files you need for your project&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.itu.dk/~friism/blog/?p=37" class="externalLink"&gt;Demo video&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;li&gt;07-1-2008 : &lt;a href="http://www.codeplex.com/LinqtoCRM/Release/ProjectReleases.aspx?ReleaseId=9683"&gt;0.2.2 Alpha&lt;/a&gt; released.&lt;/li&gt;&lt;ul&gt;
&lt;li&gt;Lots of smaller bug-fixes&lt;/li&gt;&lt;li&gt;Changed from WCF to old-school service reference&lt;/li&gt;
&lt;/ul&gt;&lt;li&gt;26-12-2007 : &lt;a href="http://www.codeplex.com/LinqtoCRM/Release/ProjectReleases.aspx?ReleaseId=9433"&gt;0.2.1 Alpha&lt;/a&gt; released.&lt;/li&gt;&lt;ul&gt;
&lt;li&gt;First new release in a while, sorry 'bout that!&lt;/li&gt;&lt;li&gt;Has been compiled with VS 2008 RTM and runs against CRM 4.0 RC0 (latest VPC)&lt;/li&gt;&lt;li&gt;Updates to result-processing code from &lt;a href="http://stunnware.com/" class="externalLink"&gt;Michael H&amp;#246;hne&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;li&gt;06-08-2007 : &lt;a href="http://www.codeplex.com/LinqtoCRM/Release/ProjectReleases.aspx?ReleaseId=6263"&gt;0.2.0 Alpha&lt;/a&gt; released.&lt;/li&gt;&lt;ul&gt;
&lt;li&gt;Based on insights from Matt Warren's series of &lt;a href="http://blogs.msdn.com/mattwar/archive/2007/08/03/linq-building-an-iqueryable-provider-part-v.aspx" class="externalLink"&gt;articles&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;&lt;li&gt;Uses Visitor-pattern for query-generation&lt;/li&gt;&lt;li&gt;Ordering implemented&lt;/li&gt;&lt;li&gt;Ported to IQeryProvider/IQeryable-model&lt;/li&gt;
&lt;/ul&gt;&lt;li&gt;01-08-2007 : &lt;a href="http://www.codeplex.com/LinqtoCRM/Release/ProjectReleases.aspx?ReleaseId=6187"&gt;0.1.1 Alpha&lt;/a&gt; released. &lt;/li&gt;&lt;ul&gt;
&lt;li&gt;Compiles and runs (in it's own fashion) under VS 2008 Beta 2&lt;/li&gt;&lt;li&gt;FetchXML-library included as DLL in release (with thanks to Michael H&amp;#246;hne)&lt;/li&gt;
&lt;/ul&gt;&lt;li&gt;30-07-2007 : CodePlex site created, initial code uploaded (very crude early alpha - &lt;a href="http://www.codeplex.com/LinqtoCRM/Release/ProjectReleases.aspx?ReleaseId=6153"&gt;0.1.0 Alpha&lt;/a&gt;)&lt;/li&gt;
&lt;/ul&gt; &lt;br /&gt;&lt;h2&gt;
Todo
&lt;/h2&gt;&lt;ul&gt;
&lt;li&gt;Handle arbitrary selectors. &lt;a href="http://blogs.msdn.com/mattwar/archive/2007/08/03/linq-building-an-iqueryable-provider-part-v.aspx" class="externalLink"&gt;Matt Warren&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt; has shown how to do this but I'm having a very hard time grok'ing his implementation, even with the description on his blog. The basic idea is to look at the selector-expression and figure out where entity-attributes are actually referenced. These occurences are replaced with expressions that will evaluate correctly once the actual values have been retrieved. The code probably won't get as complex as Matt's because FetchXML is considerably less expressive than SQL and we can give up earlier.&lt;/li&gt;&lt;li&gt;A visual debugger/visualizer to show were you've been too ambitious with your query. Bart De Smet seems to have the right &lt;a href="http://community.bartdesmet.net/blogs/linqtosharepoint/archive/2007/07/05/linq-to-sharepoint-improving-the-parser-debugger-visualizer-fun.aspx" class="externalLink"&gt;idea&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;&lt;li&gt;A &amp;quot;pedal-to-the-metal&amp;quot; toggle. If the code will be running with acess to the SQL-server, the developer can specify that the query should be translated to SQL and run on the filtered views at the flick of a switch.&lt;/li&gt;&lt;li&gt;The CRM web service is tangled up in the queryprovider code. It would be desirable if it could be moved outside and accessed though an interface. The code is rather dependent on the types exposed by the web service proxy-classes and it is not clear how this dependency could be removed without implementing something along the lines of SQLMetal/SPMetal.&lt;/li&gt;&lt;ul&gt;
&lt;li&gt;Support for N:N could be a part of this effort. See discussion here: &lt;a href="http://www.codeplex.com/LinqtoCRM/WorkItem/View.aspx?WorkItemId=4709" class="externalLink"&gt;http://www.codeplex.com/LinqtoCRM/WorkItem/View.aspx?WorkItemId=4709&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/ul&gt; &lt;br /&gt;&lt;h2&gt;
Credits
&lt;/h2&gt;&lt;ul&gt;
&lt;li&gt;Mel Gerats for implementing paging, contains and loads of other stuff&lt;/li&gt;&lt;li&gt;Bart De Smet for the inspirational &lt;a href="http://www.codeplex.com/LINQtoSharePoint" class="externalLink"&gt;LINQtoSharePoint&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt; implementation&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.stunnware.com/crm/" class="externalLink"&gt;Michael H&amp;#246;hne&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt; for his FetchXML library&lt;/li&gt;&lt;li&gt;Matt Warren for his articles on QueryProvider-building: &lt;a href="http://blogs.msdn.com/mattwar/archive/2007/08/03/linq-building-an-iqueryable-provider-part-v.aspx" class="externalLink"&gt;http://blogs.msdn.com/mattwar/archive/2007/08/03/linq-building-an-iqueryable-provider-part-v.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;</description><author>friism</author><pubDate>Fri, 22 Aug 2008 10:28:33 GMT</pubDate><guid isPermaLink="false">Updated Wiki: Home 20080822102833A</guid></item><item><title>Released: 0.2.7 Beta (Aug 22, 2008)</title><link>http://www.codeplex.com/LinqtoCRM/Release/ProjectReleases.aspx?ReleaseId=16542</link><description>&lt;div&gt;
From readme&lt;br&gt;&lt;pre&gt;
Welcome to LinqtoCRM
 
Getting Started
===============
 
* Add the following files to your project: CrmQueryProvider.cs, CrmWebService.cs, Evaluator.cs, 
	ExpressionVisitor.cs, IService.cs, QueryFormatter.cs, QueryProvider.cs, TypeSystem.cs
* Correct the name of the webservice reference in CrmWebService.cs
* Add a reference to stunnware.CRM.Fetch.dll.
* Add &amp;quot;using LinqtoCRM;&amp;quot;
 
Start Coding!
 
Limitations
===========
 
You can only select anonymous types consisting of CRM entity attributes, like this:
select new { myContact.fullname, myAccount.name }
... or select full entities which will retrieve all attributes:
from c in p.Linq&amp;lt;contact&amp;gt;() select c
 
No support for N:N relationships.
 
Notes
=====
The current project was built with VS 2008 RTM and is known to work against CRM 4.0 RTM.
 
Check the codeplex page for updates: http://www.codeplex.com/LinqtoCRM
 
Found a query you think should work, but LinqtoCRM breaks or returns the wrong data? Please 
send it to me at friism+linqtocrm@gmail.com or create a workitem in the codeplex site.
 
Contributers
============
 
* Michael Friis (initial version, maintenance)
* Michael H&amp;#246;hne (fixes to result parsing code, provided FetchXML lib)
* Mel Gerats (implemented paging with skip/take, chained queries, contains, count and many other improvements to the code)
 
---
 
Michael Friis
http://www.itu.dk/~friism/blog/
&lt;/pre&gt; &lt;br&gt;
&lt;/div&gt;</description><author></author><pubDate>Fri, 22 Aug 2008 10:24:44 GMT</pubDate><guid isPermaLink="false">Released: 0.2.7 Beta (Aug 22, 2008) 20080822102444A</guid></item><item><title>Updated Release: 0.2.7 Beta (Aug 22, 2008)</title><link>http://www.codeplex.com/LinqtoCRM/Release/ProjectReleases.aspx?ReleaseId=16542</link><description>&lt;div&gt;
From readme&lt;br&gt;&lt;pre&gt;
Welcome to LinqtoCRM
 
Getting Started
===============
 
* Add the following files to your project: CrmQueryProvider.cs, CrmWebService.cs, Evaluator.cs, 
	ExpressionVisitor.cs, IService.cs, QueryFormatter.cs, QueryProvider.cs, TypeSystem.cs
* Correct the name of the webservice reference in CrmWebService.cs
* Add a reference to stunnware.CRM.Fetch.dll.
* Add &amp;quot;using LinqtoCRM;&amp;quot;
 
Start Coding!
 
Limitations
===========
 
You can only select anonymous types consisting of CRM entity attributes, like this:
select new { myContact.fullname, myAccount.name }
... or select full entities which will retrieve all attributes:
from c in p.Linq&amp;lt;contact&amp;gt;() select c
 
No support for N:N relationships.
 
Notes
=====
The current project was built with VS 2008 RTM and is known to work against CRM 4.0 RTM.
 
Check the codeplex page for updates: http://www.codeplex.com/LinqtoCRM
 
Found a query you think should work, but LinqtoCRM breaks or returns the wrong data? Please 
send it to me at friism+linqtocrm@gmail.com or create a workitem in the codeplex site.
 
Contributers
============
 
* Michael Friis (initial version, maintenance)
* Michael H&amp;#246;hne (fixes to result parsing code, provided FetchXML lib)
* Mel Gerats (implemented paging with skip/take, chained queries, contains, count and many other improvements to the code)
 
---
 
Michael Friis
http://www.itu.dk/~friism/blog/
&lt;/pre&gt; &lt;br&gt;
&lt;/div&gt;</description><author></author><pubDate>Fri, 22 Aug 2008 10:24:44 GMT</pubDate><guid isPermaLink="false">Updated Release: 0.2.7 Beta (Aug 22, 2008) 20080822102444A</guid></item><item><title>Created Issue: Ditch FetchXMLlib in favour of LinqtoXSD</title><link>http://www.codeplex.com/LinqtoCRM/WorkItem/View.aspx?WorkItemId=5806</link><description>http&amp;#58;&amp;#47;&amp;#47;live.mscommunity.net&amp;#47;blogs&amp;#47;dadamec&amp;#47;archive&amp;#47;2008&amp;#47;02&amp;#47;29&amp;#47;linq-to-xsd-alpha-0-2-refresh-for-visual-studio-2008.aspx&lt;br /&gt;</description><author>friism</author><pubDate>Fri, 22 Aug 2008 10:14:25 GMT</pubDate><guid isPermaLink="false">Created Issue: Ditch FetchXMLlib in favour of LinqtoXSD 20080822101425A</guid></item><item><title>Closed Issue: Where clauses on linked entity attributes fail</title><link>http://www.codeplex.com/LinqtoCRM/WorkItem/View.aspx?WorkItemId=5390</link><description>&amp;#91;Reported my mraufer&amp;#93;&lt;br /&gt;This query fails&amp;#58;&lt;br /&gt;var contacts &amp;#61; from c in provider.Linq&amp;#60;contact&amp;#62;&amp;#40;&amp;#41;&lt;br /&gt;                           join a in provider.Linq&amp;#60;account&amp;#62;&amp;#40;&amp;#41;&lt;br /&gt;                           on c.parentcustomerid.Value equals a.accountid.Value&lt;br /&gt;                           where a.name.Contains&amp;#40;&amp;#34;Sports&amp;#34;&amp;#41;&lt;br /&gt;                           select c&amp;#59;&lt;br /&gt;&lt;br /&gt;The reason is that LinqtoCRM always creates filters on the root entity.&lt;br /&gt;</description><author>melg</author><pubDate>Fri, 22 Aug 2008 07:57:47 GMT</pubDate><guid isPermaLink="false">Closed Issue: Where clauses on linked entity attributes fail 20080822075747A</guid></item><item><title>Source code checked in, #22501</title><link>http://www.codeplex.com/LinqtoCRM/SourceControl/ListDownloadableCommits.aspx</link><description>Filters on linked entities are now applied to the correct entity</description><author>melg</author><pubDate>Fri, 22 Aug 2008 07:57:43 GMT</pubDate><guid isPermaLink="false">Source code checked in, #22501 20080822075743A</guid></item></channel></rss>