Generic Dynamics CRM 2011 connection component

Recently I came across this little gem: Connection Controls for Microsoft Dynamics CRM. It is written by tanguy92 and contains a generic library for connecting to Dynamics Online, On Premise or on IFD.

It also includes a dynamics user interface for WinForms which is looking very nice, easy to install and in my opinion quite user friendly…

The biggest con is that the UI code is mixed up with the connection code, so with the current codebase you can’t really use the component as your library for connecting to CRM from anywhere (WPF, WinForms, ASP.NET, Windows Services etc..). However it is very easy to extract the UI code from the library..

 

I already did that, so I’ll try to get it added to the project (Still have to do some bugfixing and cleaning), but meanwhile I still suggest you to check it out!

Share
Posted in .NET, C#, CRM | Tagged , , , , , , , , | Leave a comment

Converting Dynamics Entity instances to crmsvcutil generated classes and visa verca

Sometimes you run into situations in your Dynamics CRM 2011 code where you have an Entity-class and you would like to have it converted to its typesafe counterpart. In other cases you would like to do it the other way around.

And there is no reason why this would not be possible, because the typesafe classes actually inherit the Entity class. Microsoft actually build a solution for this if you look more closely on the entity class. You can simply convert an Entity-instance to an typesafe account-instance if you do the following:


Account account = entity.ToEntity<Account>();

The other way around ofcourse is even easier:


Entity accountEntity = (Entity)account;

 

Share
Posted in C#, CRM | Tagged , , , , | Leave a comment

Unhandled Exception: System.InvalidOperationException: Object of type ‘X’ can not be converted to type ‘IBusinessEntity’

I ran today into a very weird problem when developing for Dynamics CRM 2011. When I ran a plugin which had references to custom dlls which were placed in the GAC, certain actions on the CRM web service would fail with the message: ‘ Unexpected error occured’ (Very helpfull MS, thank you!). When you would run the code in a console application or even when you ran the plugin with all the code in 1 assembly, it would work.

So I fired up the CRM2011Diag tool and the following error popped up: Unhandled Exception: System.InvalidOperationException: Object of type ‘X’ can not be converted to type ‘IBusinessEntity’. 

Luckily that’s a more clear exception, but now up to the solution. That is actually quite easy. Just add the following line to your AssemblyInfo file and redeploy your dll:

</span>

[assembly: Microsoft.Xrm.Sdk.Client.ProxyTypesAssembly]

<span style="font-size: small;">

Share
Posted in C#, CRM | Leave a comment

Linq to XSD tutorial

Although Linq to XSD is a nice component, Microsoft seems to have abandoned it already a while ago. However the component is still very well usable, but lacks easy documentation for beginners. I just ran across a nice codeproject-article which should give you a good start using it!

Share
Posted in .NET, ASP.NET, C#, Development | Tagged , , , , , | Leave a comment

Some random LIVE-play stats (4)

More uninteresting stats of my LIVE-gaming adventures! What LIVE? Yes, because nowadays Live is more then just the 360, it also includes WP7 and PC.. Yah ;)

  • I have played on 3 platforms, namely PC, Windows Phone and Xbox 360
  • Foreach platform I have played the following number of games:
    1. PC: 1 game
    2. Windows Phone: 5 games
    3. Xbox 360: 117 games (oops :) )
  • Overall I have earned 1602 different achievements.
Share
Posted in Games, Xbox360 | Tagged , , , | 1 Comment