简体   繁体   中英

Convert ImgContext Columns Spool Table of BizTalkMsgBoxDb Database into XML Format

Is there any way that C# application Convert BizTalk Server BizTalkMsgBoxDb Database Spool Table ImgContext Columns in Original format that we show in BizTalk.

Here, Is my ImgContext value Datatype is image.

在此处输入图像描述

Here is my simple application code.

在此处输入图像描述

Here I need to actually output look like same as BizTalk.

在此处输入图像描述

Use the below code for resolved your logs issue with the external services, use the spool table of BizTalkMsgBoxDb.

    if (row["imgContext"].GetType() != typeof(DBNull))
    {
        SqlBinary contextData = new SqlBinary((byte[])row["imgContext"])                         //Use memory stream and IBTMessageAgentFactory to get context
        Console.WriteLine("Message Context:");
        Console.WriteLine("");
        
        MemoryStream contextstream = new MemoryStream(contextData.Value);
        IBaseMessageContext context = ((IBTMessageAgentFactory)((IBTMessageAgent)new BTMessageAgent())).CreateMessageContext();
        ((IPersistStream) context).Load(contextstream); Console.WriteLine("NAME ,Value ,  TYPE , Namespace");
        for (int i = 0; i<context.CountProperties; ++i)
        {
            string propName;
            string propNamespace;
            object propValue = context.ReadAt(i, out propName, out propNamespace);
            string type = context.IsPromoted(propName, propNamespace) ? "Promoted" : "No Promoted";
            Console.WriteLine(propName + " || " + propValue.ToString() + " || "+ type + " || "+ propNamespace );
        }
    }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM