Skip to content

Commit

Permalink
Merge pull request #33 from brahmnes/develop
Browse files Browse the repository at this point in the history
Fix Fxcop error by implement IDisposable on CorrelatingRemotingMessag…
  • Loading branch information
brahmnes authored Oct 9, 2017
2 parents 18fd7db + 92e66a5 commit faa4d0f
Showing 1 changed file with 35 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
/// Service remoting handler that wraps a service and parses correlation id and context, if they have been passed by the caller as
/// message headers. This allows traces the client and the service to log traces with the same relevant correlation id and context.
/// </summary>
public class CorrelatingRemotingMessageHandler : IServiceRemotingMessageHandler
public class CorrelatingRemotingMessageHandler : IServiceRemotingMessageHandler, IDisposable
{
private Lazy<DataContractSerializer> baggageSerializer;

Expand Down Expand Up @@ -184,5 +184,39 @@ private static string GetOperationId(string id)
int rootStart = id[0] == '|' ? 1 : 0;
return id.Substring(rootStart, rootEnd - rootStart);
}

#region IDisposable Support
private bool disposedValue = false; // To detect redundant calls

/// <summary>
/// Overridden by derived class to dispose and clean up resources used by <see cref="CorrelatingRemotingMessageHandler"/>.
/// </summary>
/// <param name="disposing">Whether it should dispose managed resources.</param>
protected virtual void Dispose(bool disposing)
{
if (!disposedValue)
{
if (disposing)
{
IDisposable disposableHandler = this.innerHandler as IDisposable;
if (disposableHandler != null)
{
disposableHandler.Dispose();
}
}

disposedValue = true;
}
}

/// <summary>
/// Dispose and clean up resources used by <see cref="CorrelatingRemotingMessageHandler"/>
/// </summary>
public void Dispose()
{
// Do not change this code. Put cleanup code in Dispose(bool disposing) above.
Dispose(true);
}
#endregion // IDisposable Support
}
}

0 comments on commit faa4d0f

Please sign in to comment.