/// <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)); } } } }
public static BizTalkPropertyBag DeserializeContext(Stream input) { using (var contextReader = new BizTalkContextReader(input)) return(contextReader.ReadContext()); }
/// <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); } } } }