Experimental context reader. Still havent reverse-engineered the entire format. A bit shaky and full of Asserts. Use with caution.
Inheritance: IDisposable
Example #1
0
        /// <summary>
        /// Loads the tracked message context. Returns null if no part fragment was found.
        /// </summary>
        /// <param name="messageId">The message id.</param>
        /// <param name="spoolId">The spool id.</param>
        public BizTalkPropertyBag LoadTrackedMessageContext(Guid messageId, int spoolId)
        {
            using (var connection = new SqlConnection(this.ConnectionString))
                using (var cmd = CreateStoredProcedureCommand(connection, "ops_LoadTrackedMessageContext"))
                {
                    AddInParameter(cmd, "@uidMessageID", SqlDbType.UniqueIdentifier, messageId);
                    AddInParameter(cmd, "@nSpoolID", SqlDbType.Int, spoolId);

                    connection.Open();

                    using (var reader = cmd.ExecuteReader())
                    {
                        if (!reader.Read())
                        {
                            return(null);
                        }

                        var imgContext = (byte[])reader.GetValue(0);

                        using (var ms = new MemoryStream(imgContext))
                            using (var ctxReader = new BizTalkContextReader(ms))
                            {
                                var properties = ctxReader.ReadContextProperties();

                                return(new BizTalkPropertyBag(properties));
                            }
                    }
                }
        }
Example #2
0
 public static BizTalkPropertyBag DeserializeContext(Stream input)
 {
     using (var contextReader = new BizTalkContextReader(input))
         return(contextReader.ReadContext());
 }
Example #3
0
        /// <summary>
        /// Loads the tracked message context. Returns null if no part fragment was found.
        /// </summary>
        /// <param name="messageId">The message id.</param>
        /// <param name="spoolId">The spool id.</param>
        public BizTalkPropertyBag LoadTrackedMessageContext(Guid messageId, int spoolId)
        {
            using (var connection = new SqlConnection(this.ConnectionString))
            using (var cmd = CreateStoredProcedureCommand(connection, "ops_LoadTrackedMessageContext"))
            {
                AddInParameter(cmd, "@uidMessageID", SqlDbType.UniqueIdentifier, messageId);
                AddInParameter(cmd, "@nSpoolID", SqlDbType.Int, spoolId);

                connection.Open();

                using (var reader = cmd.ExecuteReader())
                {
                    if (!reader.Read())
                        return null;

                    var imgContext = (byte[])reader.GetValue(0);

                    using (var ms = new MemoryStream(imgContext))
                    using (var ctxReader = new BizTalkContextReader(ms))
                    {
                        var properties = ctxReader.ReadContextProperties();

                        return new BizTalkPropertyBag(properties);
                    }
                }
            }
        }