##// END OF EJS Templates
addded ServiceHost tests, updated project targets
addded ServiceHost tests, updated project targets

File last commit:

r295:28af686e24f7 default
r299:d54174bbd6c4 tip default
Show More
TraceSourceChannel`1.cs
31 lines | 1.2 KiB | text/x-csharp | CSharpLexer
/ Implab / src / Diagnostics / TraceSourceChannel`1.cs
cin
Added tests for Implab.ServiceHost.Unity configuration loader.
r289 using System;
using System.Threading;
namespace Implab.Diagnostics {
/// <summary>
/// This class is used to provide a single <see cref="TraceSourceChannel"/>
/// instance for the specified class in <typeparamref name="T"/> parameter.
/// </summary>
/// <typeparam name="T">
/// The class for which <see cref="TraceSourceChannel"/> is required.
/// </typeparam>
/// <remarks>
/// The <see cref="TraceSourceChannel"/> instance will be created on demand
/// and automatically registered in <see cref="TraceRegistry.Global"/>.
/// </remarks>
public static class TraceSourceChannel<T> {
static Lazy<TraceSourceChannel> _traceSource = new Lazy<TraceSourceChannel>(CreateChannel, LazyThreadSafetyMode.ExecutionAndPublication);
/// <summary>
/// The default <see cref="TraceSourceChannel"/> instance.
/// </summary>
public static TraceSourceChannel Default { get { return _traceSource.Value; } }
static TraceSourceChannel CreateChannel() {
var channel = new TraceSourceChannel(typeof(T), typeof(T).FullName);
TraceRegistry.Global.Register(channel);
return channel;
}
}
}