Example #1
0
        public void ReapplyAllCachedContextProperties(ContextInstructionTypeEnum promotion)
        {
            FetchCachedContext();

            foreach (KeyValuePair <string, object> kp in cacheItems)
            {
                string[] contextPropertyType = kp.Key.Split('#');

                string propertyName      = string.Empty;
                string propertyNamespace = string.Empty;

                if (contextPropertyType.Length == 2)
                {
                    propertyNamespace = contextPropertyType[0];
                    propertyName      = contextPropertyType[1];
                }
                else
                {
                    propertyName = contextPropertyType[0];
                }

                SetContextPropertyPipelineInstruction instruction = new SetContextPropertyPipelineInstruction(propertyName, propertyNamespace, kp.Value, promotion);
                base.AddInstruction(instruction);
            }
        }
Example #2
0
        public void ReapplyCachedContextProperty(string propertyName, string propertyNamespace, ContextInstructionTypeEnum promotion, CacheFailureEnum failureAction)
        {
            object property;

            FetchCachedContext();
            bool propertyFound = cacheItems.TryGetValue(string.Format("{0}#{1}", propertyNamespace, propertyName), out property);

            if (!propertyFound)
            {
                if (failureAction == CacheFailureEnum.RaiseAnException)
                {
                    Exception exc = new Exception(String.Format("Unable to get cached context property {0}#{1}.", propertyNamespace, propertyName));
                    base.SetException(exc);
                }
                else if (failureAction == CacheFailureEnum.IgnoreAndCarryOn)
                {
                    // Take no action
                }
            }
            else
            {
                SetContextPropertyPipelineInstruction instruction = new SetContextPropertyPipelineInstruction(propertyName, propertyNamespace, property, promotion);
                base.AddInstruction(instruction);
            }
        }
Example #3
0
        public void DisassembleXMLMessagePropertyPromotionOnly()
        {
            SetContextPropertyPipelineInstruction instruction = new SetContextPropertyPipelineInstruction(BizTalkXMLNORMPropertySchemaEnum.PromotePropertiesOnly.ToString(),
                                                                                                          ContextPropertyNamespaces._XMLNormPropertyNamespace, true, ContextInstructionTypeEnum.Write);

            base.AddInstruction(instruction);

            ApplyXmlDisassemblerInstruction disassemblyInstruction = new ApplyXmlDisassemblerInstruction();

            base.AddInstruction(disassemblyInstruction);
        }
Example #4
0
        /// <summary>
        /// Transform a message using the specified map class with the specified level of source schema validation and with property promotion on the target message
        /// </summary>
        public void TransformMessageWithPromotion(string mapClassName, string mapAssemblyName, TransformationSourceSchemaValidation validation)
        {
            SetContextPropertyPipelineInstruction noDebatchInstruction = new SetContextPropertyPipelineInstruction(BizTalkXMLNORMPropertySchemaEnum.PromotePropertiesOnly.ToString(),
                                                                                                                   ContextPropertyNamespaces._XMLNormPropertyNamespace, true, ContextInstructionTypeEnum.Write);

            base.AddInstruction(noDebatchInstruction);

            TransformationInstruction instruction = new TransformationInstruction(mapClassName, mapAssemblyName, validation, CallToken);

            base.AddInstruction(instruction);

            ApplyXmlDisassemblerInstruction promotionInstruction = new ApplyXmlDisassemblerInstruction();

            base.AddInstruction(promotionInstruction);
        }
Example #5
0
        /// <summary>
        /// Setup an Instruction that will either promote or write a specified value to a context property within any namespace
        /// </summary>
        /// <param name="propertyName">The name of the context property</param>
        /// <param name="propertyNamespace">The namespace of the context property</param>
        /// <param name="value">The value to be written/promoted to the context</param>
        /// <param name="promotion">Whether to write or promote the context property</param>
        /// <param name="type">The type to cast the value to</param>
        public void SetCustomContextProperty(string propertyName, string propertyNamespace, object value, ContextInstructionTypeEnum promotion, TypeEnum type)
        {
            SetContextPropertyPipelineInstruction instruction = new SetContextPropertyPipelineInstruction(propertyName, propertyNamespace, value, promotion, type);

            base.AddInstruction(instruction);
        }