More About This Website

All information is provided "AS IS" with no warranties, and confers no rights

Login
Powered by Squarespace
« There is an error in XML document RC0 | Main | RTM of Visual Studio 2008 »
Friday
Nov232007

ICrmService and IMetadataService in RC0

Looks like there was a small change for the good on the return types for IPluginContext.CreateCrmService and CreateMetadataService.  In CTP3, these used to return an object and you used to have to cast it to a CrmService object to use it.  The following is an example from the SDK...

CrmService service = (CrmService)context.CreateCrmService(true);

This created a few different problems most of them flexibility around what object is being returned.  If CreateCrmService ever returned an object of a different type, you would either get a null or a cast exception.

Now with it returning an interface ICrmService you should be able to do the following...

ICrmService service = context.CreateCrmService(true);

Notice I don't do the cast, I reference it via the interface and by doing that I really don't care what the actual class type that is returned by the create is.

Applause for the CRM team, this is one I had asked for and didn't think would make it in for RTM - Good Job!

EmailEmail Article to Friend

Reader Comments

There are no comments for this journal entry. To create a new comment, use the form below.

PostPost a New Comment

Enter your information below to add a new comment.

My response is on my own website »
Author Email (optional):
Author URL (optional):
Post:
 
All HTML will be escaped. Hyperlinks will be created for URLs automatically.