Пример #1
0
 private static XmlDocument CreateMessage(DocumentSpec documentSpec)
 {
     using (var writer = new StringWriter())
     {
         var document = new XmlDocument();
         document.Load(documentSpec.CreateXmlInstance(writer));
         return(document);
     }
 }
Пример #2
0
      /// <summary>
      /// Creates a document specification from a CLR
      /// Type representing the root node of a BizTalk
      /// compiled Schema
      /// </summary>
      /// <param name="schemaType">The schema to create</param>
      /// <returns>The document specification object</returns>
      public IDocumentSpec LoadDocSpec(Type schemaType)
      {
         if ( schemaType == null )
            throw new ArgumentNullException("schemaType");
         if ( !schemaType.IsSubclassOf(typeof(SchemaBase)) )
            throw new ArgumentException("Type does not represent a schema", "schemaType");

         string typename = schemaType.FullName;
         string assemblyName = schemaType.Assembly.FullName;
         DocumentSpec docSpec = new DocumentSpec(typename, assemblyName);

         return docSpec;
      }
Пример #3
0
 private static XmlDocument Create(DocumentSpec documentSpec)
 {
     using (var writer = new StringWriter())
         using (var reader = XmlReader.Create(documentSpec.CreateXmlInstance(writer), new XmlReaderSettings {
             CloseInput = true, XmlResolver = null
         }))
         {
             var document = new XmlDocument {
                 XmlResolver = null
             };
             document.Load(reader);
             return(document);
         }
 }
Пример #4
0
        /// <summary>
        /// Creates a document specification from a CLR
        /// Type representing the root node of a BizTalk
        /// compiled Schema
        /// </summary>
        /// <param name="schemaType">The schema to create</param>
        /// <returns>The document specification object</returns>
        public IDocumentSpec LoadDocSpec(Type schemaType)
        {
            if (schemaType == null)
            {
                throw new ArgumentNullException("schemaType");
            }
            if (!schemaType.IsSubclassOf(typeof(SchemaBase)))
            {
                throw new ArgumentException("Type does not represent a schema", "schemaType");
            }

            string       typename     = schemaType.FullName;
            string       assemblyName = schemaType.Assembly.FullName;
            DocumentSpec docSpec      = new DocumentSpec(typename, assemblyName);

            return(docSpec);
        }
Пример #5
0
        /// <summary>
        /// Initializes an instance of SchemaMap class.
        /// </summary>
        /// <param name="schemaList">A list of schemas</param>
        public SchemaMap(SchemaList schemaList)
        {
            if (null == schemaList)
            {
                throw new ArgumentNullException("schemaList");
            }

            foreach (Schema schema in schemaList)
            {
                // There is a known drawback in BizTalk Server 2016 when there is no way to find
                // out an assembly name for pipeline from a pipeline component, so local schemas are
                // always retrieved by message type.
                if (null == schema.AssemblyName)
                {
                    continue;
                }

                IDocumentSpec documentSpec = new DocumentSpec(schema.DocSpecName, schema.AssemblyName);
                schemaMap.Add(documentSpec.DocType, documentSpec);
            }
        }