This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: 0.1$(Rev:.r) | |
queue: Hosted VS2017 | |
variables: | |
buildConfiguration: 'Release' | |
buildProjects: '**/*.csproj' | |
packageProjects: '**/*.sfproj' | |
testProjects: '**/*Tests*.csproj' | |
dotnetCliVersion: '2.1.300' | |
steps: | |
# Restore the packages for all projects in the 'buildProjects' variable |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: 0.1.0 | |
trigger: | |
branches: | |
include: | |
- master | |
- hotfix/* | |
- release/* | |
- feature/* | |
- bugfix/* | |
- backlog/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
using(CorrelationContext.CreateCorrelationIfNotExists()) | |
{ | |
Console.WriteLine(CorrelationContext.GetCorrelationId()); | |
using(CorrelationContext.CreateCorrelationIfNotExists()) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private class DisposeCorrelation : IDisposable | |
{ | |
private readonly AsyncLocal<Stack<Guid>> _localStack; | |
public DisposeCorrelation(AsyncLocal<Stack<Guid>> localStack) | |
{ | |
_localStack = localStack; | |
} | |
public void Dispose() | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static IDisposable CreateCorrelationIfNotExists(Guid? correlationId = null) | |
{ | |
if(GetCorrelationStack().Count > 0) | |
return new EmptyDisposable(); | |
return CreateCorrelation(correlationId); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static IDisposable CreateCorrelation(Guid? correlationId = null) | |
{ | |
if (_correlationStack.Value == null) | |
_correlationStack.Value = new Stack<Guid>(); | |
_correlationStack.Value.Push(correlationId ?? Guid.NewGuid()); | |
return new DisposeCorrelation(_correlationStack); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static Guid? GetCorrelationId() | |
{ | |
var stack = GetCorrelationStack(); | |
if(stack.Count > 0) | |
return stack.Peek(); | |
return null; // TODO :: decide what you are going to do | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static readonly AsyncLocal<Stack<Guid>> _correlationStack = new AsyncLocal<Stack<Guid>>(); | |
public static Stack<Guid> GetCorrelationStack() => _correlationStack.Value ?? new Stack<Guid>(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class CorrelationContext | |
{ | |
public static Stack<Guid> GetCorrelationStack() {} | |
public static Guid? GetCorrelationId() {} | |
public static IDisposable CreateCorrelation(Guid? correlationId = null) {} | |
public static IDisposable CreateCorrelationIfNotExists(Guid? correlationId = null) {} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class CorrelationContext | |
{ | |
public static Stack<Guid> GetCorrelationStack() {} | |
public static Guid? GetCorrelationId() {} | |
public static IDisposable CreateCorrelation(Guid? correlationId = null) {} | |
public static IDisposable CreateCorrelationIfNotExists(Guid? correlationId = null) {} | |
} |
NewerOlder