I just posted a pretty cool sample of how you could call a map dynmically in C#.   Very nice.  However, it has a drawback (besides being officially unsupported).  

Specifically, the way I used TransformBase in the sample will result in regenerating a dynamic assembly for the xslt every time the code is executed. We’d run out of memory very quickly.

Here’s the solution.  One of our engineers, Yossi Levanoni, created the Metadata classes that basically cache everything there is to cache for any of the XLANG artifacts, including maps.  

By replacing these lines of code:

    Assembly mapAssembly = Assembly.LoadWithPartialName(“EAISchemas”);
    Type mapTypeClass = mapAssembly.GetType(“EAISchemas.MapToReqDenied”);
    TransformBase map = (TransformBase)System.Activator.CreateInstance(mapTypeClass);
    XslTransform transform = map.Transform;
    XsltArgumentList argList = map.TransformArgs;

With this :

   using Microsoft.XLANGs.RuntimeTypes;

    XslTransform transform = TransformMetaData.For(typeof(EAISchemas.MapToReqDenied)).Transform;
    XsltArgumentList argList = TransformMetaData.For(typeof(EAISchemas.MapToReqDenied)).ArgumentList;

Will result in the maps being pulled from our Cache rather than from the Assembly each and every time….

Pretty cool stuff!