locked
BizTalk Map Generated Class RRS feed

  • Question

  • Hi All,

    As far as i know When compiling a BizTalk project that containing The map you building, the compiler does the following:

    1. Generates XSLT from your BTM file. 
    2. Generates a class to represent your map which contains the XSLT as a string, and (optionally) the Extension Object data (also as a string). The class inherits from Microsoft.XLANGs.BaseTypes.TransformBase.

    The generated class is what is used to perform the translation can be disassembled and viewed  using .NET Reflector.

    I would like to know were in the project can i find this class(file) and what is it called??

    I would like to view it using .Net reflector.

    Thanks in advance for your assistance


    Lesibana Chokoe

    Monday, February 20, 2017 9:33 PM

Answers

  • Hi Lesibana,

    Once you have successfully built your solution, you will find the the auto generated class file of your map at your visual studio project file location itself.

    For sample:

    

    Content:

    namespace BizTalk_Server_Project1 {
        
        
        [Microsoft.XLANGs.BaseTypes.SchemaReference(@"BizTalk_Server_Project1.Schema1", typeof(global::BizTalk_Server_Project1.Schema1))]
        [Microsoft.XLANGs.BaseTypes.SchemaReference(@"BizTalk_Server_Project1.Schema1", typeof(global::BizTalk_Server_Project1.Schema1))]
        public sealed class Map1 : global::Microsoft.XLANGs.BaseTypes.TransformBase {
            
            private const string _strMap = @"<?xml version=""1.0"" encoding=""UTF-16""?>
    <xsl:stylesheet xmlns:xsl=""http://www.w3.org/1999/XSL/Transform"" xmlns:msxsl=""urn:schemas-microsoft-com:xslt"" xmlns:var=""http://schemas.microsoft.com/BizTalk/2003/var"" exclude-result-prefixes=""msxsl var userCSharp"" version=""1.0"" xmlns:ns0=""http://BizTalk_Server_Project1.Schema1"" xmlns:userCSharp=""http://schemas.microsoft.com/BizTalk/2003/userCSharp"">
      <xsl:output omit-xml-declaration=""yes"" method=""xml"" version=""1.0"" />
      <xsl:template match=""/"">
        <xsl:apply-templates select=""/ns0:Root"" />
      </xsl:template>
      <xsl:template match=""/ns0:Root"">
        <ns0:Root>
          <xsl:variable name=""var:v1"" select=""userCSharp:convertHireDate(string(DateTime/text()))"" />
          <DateTime>
            <xsl:value-of select=""$var:v1"" />
          </DateTime>
        </ns0:Root>
      </xsl:template>
      <msxsl:script language=""C#"" implements-prefix=""userCSharp""><![CDATA[
    public static string convertHireDate(string sdatetime)
    {
        //if the input from source schema datetime is in format as ""2013-10-21T00:00:00"" 
        //string sdatetime = ""2013-10-21T00:00:00"";
        return   System.DateTime.ParseExact(sdatetime, ""yyyy-MM-ddTHH:mm:sszzz"", null).ToString(""dd'/'MM'/'yyyy HH':'mm':'ss"");
    }
    
    
    ]]></msxsl:script>
    </xsl:stylesheet>";
            
            private const int _useXSLTransform = 0;
            
            private const string _strArgList = @"<ExtensionObjects />";
            
            private const string _strSrcSchemasList0 = @"BizTalk_Server_Project1.Schema1";
            
            private const global::BizTalk_Server_Project1.Schema1 _srcSchemaTypeReference0 = null;
            
            private const string _strTrgSchemasList0 = @"BizTalk_Server_Project1.Schema1";
            
            private const global::BizTalk_Server_Project1.Schema1 _trgSchemaTypeReference0 = null;
            
            public override string XmlContent {
                get {
                    return _strMap;
                }
            }
            
            public override int UseXSLTransform {
                get {
                    return _useXSLTransform;
                }
            }
            
            public override string XsltArgumentListContent {
                get {
                    return _strArgList;
                }
            }
            
            public override string[] SourceSchemas {
                get {
                    string[] _SrcSchemas = new string [1];
                    _SrcSchemas[0] = @"BizTalk_Server_Project1.Schema1";
                    return _SrcSchemas;
                }
            }
            
            public override string[] TargetSchemas {
                get {
                    string[] _TrgSchemas = new string [1];
                    _TrgSchemas[0] = @"BizTalk_Server_Project1.Schema1";
                    return _TrgSchemas;
                }
            }
        }
    }
    


    Rachit Sikroria (Microsoft Azure MVP)

    Tuesday, February 21, 2017 1:59 AM
    Moderator
  • Do the tutorials, and you'll be a beginner BizTalk Developer.

    The thing about integration apps, they're all different and all have their own unique situations so the Training Kit will give you the fundamentals of BizTalk App Dev, but that's just the beginning.  EDI, Xml, JSON, SQL, SAP, Custom Services, etc will all come up eventually.

    So, you'll be learning new things all the time, continuously, non-stop.

    Tuesday, February 21, 2017 10:33 PM
    Moderator

All replies

  • Hi ,

    If your requirement is to recompile the BizTalk code then you ca use  BizTalkDecompiler . Its way easy to generate your code from the MSI or dll .

    Its an old component but still works fine for the newer .net framework

    https://blogs.msdn.microsoft.com/gzunino/2006/06/09/biztalk-addin-for-reflector/


    If this answers your question please mark it accordingly. If this post is helpful, please vote as helpful by clicking the upward arrow mark next to my reply

    Monday, February 20, 2017 10:25 PM
  • Hi Lesibana,

    Once you have successfully built your solution, you will find the the auto generated class file of your map at your visual studio project file location itself.

    For sample:

    

    Content:

    namespace BizTalk_Server_Project1 {
        
        
        [Microsoft.XLANGs.BaseTypes.SchemaReference(@"BizTalk_Server_Project1.Schema1", typeof(global::BizTalk_Server_Project1.Schema1))]
        [Microsoft.XLANGs.BaseTypes.SchemaReference(@"BizTalk_Server_Project1.Schema1", typeof(global::BizTalk_Server_Project1.Schema1))]
        public sealed class Map1 : global::Microsoft.XLANGs.BaseTypes.TransformBase {
            
            private const string _strMap = @"<?xml version=""1.0"" encoding=""UTF-16""?>
    <xsl:stylesheet xmlns:xsl=""http://www.w3.org/1999/XSL/Transform"" xmlns:msxsl=""urn:schemas-microsoft-com:xslt"" xmlns:var=""http://schemas.microsoft.com/BizTalk/2003/var"" exclude-result-prefixes=""msxsl var userCSharp"" version=""1.0"" xmlns:ns0=""http://BizTalk_Server_Project1.Schema1"" xmlns:userCSharp=""http://schemas.microsoft.com/BizTalk/2003/userCSharp"">
      <xsl:output omit-xml-declaration=""yes"" method=""xml"" version=""1.0"" />
      <xsl:template match=""/"">
        <xsl:apply-templates select=""/ns0:Root"" />
      </xsl:template>
      <xsl:template match=""/ns0:Root"">
        <ns0:Root>
          <xsl:variable name=""var:v1"" select=""userCSharp:convertHireDate(string(DateTime/text()))"" />
          <DateTime>
            <xsl:value-of select=""$var:v1"" />
          </DateTime>
        </ns0:Root>
      </xsl:template>
      <msxsl:script language=""C#"" implements-prefix=""userCSharp""><![CDATA[
    public static string convertHireDate(string sdatetime)
    {
        //if the input from source schema datetime is in format as ""2013-10-21T00:00:00"" 
        //string sdatetime = ""2013-10-21T00:00:00"";
        return   System.DateTime.ParseExact(sdatetime, ""yyyy-MM-ddTHH:mm:sszzz"", null).ToString(""dd'/'MM'/'yyyy HH':'mm':'ss"");
    }
    
    
    ]]></msxsl:script>
    </xsl:stylesheet>";
            
            private const int _useXSLTransform = 0;
            
            private const string _strArgList = @"<ExtensionObjects />";
            
            private const string _strSrcSchemasList0 = @"BizTalk_Server_Project1.Schema1";
            
            private const global::BizTalk_Server_Project1.Schema1 _srcSchemaTypeReference0 = null;
            
            private const string _strTrgSchemasList0 = @"BizTalk_Server_Project1.Schema1";
            
            private const global::BizTalk_Server_Project1.Schema1 _trgSchemaTypeReference0 = null;
            
            public override string XmlContent {
                get {
                    return _strMap;
                }
            }
            
            public override int UseXSLTransform {
                get {
                    return _useXSLTransform;
                }
            }
            
            public override string XsltArgumentListContent {
                get {
                    return _strArgList;
                }
            }
            
            public override string[] SourceSchemas {
                get {
                    string[] _SrcSchemas = new string [1];
                    _SrcSchemas[0] = @"BizTalk_Server_Project1.Schema1";
                    return _SrcSchemas;
                }
            }
            
            public override string[] TargetSchemas {
                get {
                    string[] _TrgSchemas = new string [1];
                    _TrgSchemas[0] = @"BizTalk_Server_Project1.Schema1";
                    return _TrgSchemas;
                }
            }
        }
    }
    


    Rachit Sikroria (Microsoft Azure MVP)

    Tuesday, February 21, 2017 1:59 AM
    Moderator
  • Well, why are you looking for this?  You can't edit it or use it in any way.

    If you describe what you're trying to achieve, we can give you the correct guidance.

    Tuesday, February 21, 2017 1:40 PM
    Moderator
  • Are you trying to over ride this class ?

    its a default class generated by BizTalk solution. 


    Ram

    Tuesday, February 21, 2017 2:30 PM
  • Hi All 

    Thank you all for your efforts and help.

    i just wanted to know were its located and view the file.

    Below answer is perfect, thank you VERY VERY MUCH.

    Hi Lesibana,

    Once you have successfully built your solution, you will find the the auto generated class file of your map at your visual studio project file location itself.

    For sample:

    

    Content:

    namespace BizTalk_Server_Project1 {
        
        
        [Microsoft.XLANGs.BaseTypes.SchemaReference(@"BizTalk_Server_Project1.Schema1", typeof(global::BizTalk_Server_Project1.Schema1))]
        [Microsoft.XLANGs.BaseTypes.SchemaReference(@"BizTalk_Server_Project1.Schema1", typeof(global::BizTalk_Server_Project1.Schema1))]
        public sealed class Map1 : global::Microsoft.XLANGs.BaseTypes.TransformBase {
            
            private const string _strMap = @"<?xml version=""1.0"" encoding=""UTF-16""?>
    <xsl:stylesheet xmlns:xsl=""http://www.w3.org/1999/XSL/Transform"" xmlns:msxsl=""urn:schemas-microsoft-com:xslt"" xmlns:var=""http://schemas.microsoft.com/BizTalk/2003/var"" exclude-result-prefixes=""msxsl var userCSharp"" version=""1.0"" xmlns:ns0=""http://BizTalk_Server_Project1.Schema1"" xmlns:userCSharp=""http://schemas.microsoft.com/BizTalk/2003/userCSharp"">
      <xsl:output omit-xml-declaration=""yes"" method=""xml"" version=""1.0"" />
      <xsl:template match=""/"">
        <xsl:apply-templates select=""/ns0:Root"" />
      </xsl:template>
      <xsl:template match=""/ns0:Root"">
        <ns0:Root>
          <xsl:variable name=""var:v1"" select=""userCSharp:convertHireDate(string(DateTime/text()))"" />
          <DateTime>
            <xsl:value-of select=""$var:v1"" />
          </DateTime>
        </ns0:Root>
      </xsl:template>
      <msxsl:script language=""C#"" implements-prefix=""userCSharp""><![CDATA[
    public static string convertHireDate(string sdatetime)
    {
        //if the input from source schema datetime is in format as ""2013-10-21T00:00:00"" 
        //string sdatetime = ""2013-10-21T00:00:00"";
        return   System.DateTime.ParseExact(sdatetime, ""yyyy-MM-ddTHH:mm:sszzz"", null).ToString(""dd'/'MM'/'yyyy HH':'mm':'ss"");
    }
    
    
    ]]></msxsl:script>
    </xsl:stylesheet>";
            
            private const int _useXSLTransform = 0;
            
            private const string _strArgList = @"<ExtensionObjects />";
            
            private const string _strSrcSchemasList0 = @"BizTalk_Server_Project1.Schema1";
            
            private const global::BizTalk_Server_Project1.Schema1 _srcSchemaTypeReference0 = null;
            
            private const string _strTrgSchemasList0 = @"BizTalk_Server_Project1.Schema1";
            
            private const global::BizTalk_Server_Project1.Schema1 _trgSchemaTypeReference0 = null;
            
            public override string XmlContent {
                get {
                    return _strMap;
                }
            }
            
            public override int UseXSLTransform {
                get {
                    return _useXSLTransform;
                }
            }
            
            public override string XsltArgumentListContent {
                get {
                    return _strArgList;
                }
            }
            
            public override string[] SourceSchemas {
                get {
                    string[] _SrcSchemas = new string [1];
                    _SrcSchemas[0] = @"BizTalk_Server_Project1.Schema1";
                    return _SrcSchemas;
                }
            }
            
            public override string[] TargetSchemas {
                get {
                    string[] _TrgSchemas = new string [1];
                    _TrgSchemas[0] = @"BizTalk_Server_Project1.Schema1";
                    return _TrgSchemas;
                }
            }
        }
    }



    Lesibana Chokoe

    Tuesday, February 21, 2017 2:42 PM
  • But why?  What are you trying to do?

    Just want to make sure you're not heading in the wrong direction on something.

    Tuesday, February 21, 2017 4:58 PM
    Moderator
  • Hi,

    I am new to BizTalk Development and am learning to develop BizTalk Custome Factoids.

    I am reading meterial online and it tells me i can be able to view this File(class).

    ANYWAY... IS IT A GOOD IDEA TO FOCUS OR GO DEEP INTO CUSTOM FUNCTOIDS IF YOU ARE A BIZTALK DEVELOPER.

    THANKS IN ADVANCE.


    Lesibana Chokoe

    Tuesday, February 21, 2017 8:08 PM
  • Well, that's the thing.  Looking at those class files won't help with Functoid Development.  There's no relations ship between the Functoid code and the output.

    Following that, I would recommend you not attempt to develop any custom Functoids.  They create a design time dependency that's proves to be problematic and you actually don't have access to all transform features.

    I have never had a valid case for a custom functoid.

    Tuesday, February 21, 2017 9:03 PM
    Moderator
  • Thank you..

    Just a small question.

    Am using Learning Material i downloaded from Microsoft which is Microsoft BizTalk server Developer Training Kit.

    What level of knowledge will i have after learning and finishing this training series

    • Basic?
    • Intermediate?
    • High(enough to start developing live BizTalk applications? 

    Thanks very very much in advance...


    Lesibana Chokoe

    Tuesday, February 21, 2017 9:12 PM
  • Do the tutorials, and you'll be a beginner BizTalk Developer.

    The thing about integration apps, they're all different and all have their own unique situations so the Training Kit will give you the fundamentals of BizTalk App Dev, but that's just the beginning.  EDI, Xml, JSON, SQL, SAP, Custom Services, etc will all come up eventually.

    So, you'll be learning new things all the time, continuously, non-stop.

    Tuesday, February 21, 2017 10:33 PM
    Moderator
  • Thank you Thank you

    Lesibana Chokoe

    Tuesday, February 21, 2017 11:21 PM