Saturday, June 19, 2010

Visual Studio 2010, Web.Config Transformations and the Broken Bits

For those of you who are deploying web applications using the new Visual Studio 2010 features in the RTM version, keep these issues in mind when you are using the new web.config transformation features:

xdt:transform="Replace" attributes don't work properly

If you are are using application settings with a .net Project, you'll find that the XML will actually stored the value in an element rather than as a attribute. When you try to apply the "Replace" tranform on this, you'll find that the result after publishing changes the value from this


to this


Unfortunately, this actually adds the spaces to the end of your value, and the only way round it at the moment is to actually modify your code with a string.Trim() function to ignore the additional spaces. This probably also occurs anywhere you have an element representing a value rather than an attribute representing a value in your web.config.

For more information, see here and here for more information on the issue.

xdt:transform="XSLT" does not exist and is not valid although documented!

When you have a look at the documentation around the web.config transform, you'll find that there's this excellent feature where you can have a standard XSLT transform. Well, it looks like it was accidentally omitted from the final release of Visual Studio 2010, because when you go to use it, the syntax is not recognized at all, in fact it gives you this message:

"Could not resolve 'XSLT' as a type of Transform".

You can find more information about the issue here.



Saturday, June 12, 2010

CRM 4.0 QUERY T4 Template

Hi Everyone,

I've finally got around to publishing some work I've done recently which leverages LINQ to SQL, T4 Templates and the CRM 4.0 API to create a data access layer to CRM.

Originally I started write a Query provider for LINQ, but found it to be an extreme amount of work - and decided instead to return to old faithful - LINQ to SQL - which I have a good grounding in.

Recently, Microsoft have added a LINQ to CRM query provider to the SDK (Version 4.0.12) so you should check that out. If it doesn't suit you, here's an alternative.

  • Uses LINQ to SQL for Querying, meaning that you have the complete power of LINQ to SQL at your disposal
  • Database Queries do not go through CRM API, so they are potentially faster
  • Uses the CRM 4.0 API for CUD (Create, Update, Delete) operations - so data integrity is maintained.
  • Can generate only selected entities, rather than the entire CRM Entity list.
  • Works with WCF RIA services and any other technology that takes advantage of LINQ to SQL
  • You don't need to Leave the Visual Studio Environment, T4 generation is done within Visual Studio.

Anyway, if you have the time or the need, check it out here.