Program.cs
53 lines
| 1.2 KiB
| text/x-csharp
|
CSharpLexer
/ Implab.Playground / Program.cs
cin
|
r267 | using System; | ||
cin
|
r268 | using System.Diagnostics; | ||
using Implab.Diagnostics; | ||||
cin
|
r267 | using Implab.ServiceHost.Unity; | ||
cin
|
r229 | using Implab.Xml; | ||
cin
|
r267 | using Unity; | ||
using Unity.Injection; | ||||
cin
|
r229 | |||
namespace Implab.Playground { | ||||
cin
|
r267 | |||
public class Foo { | ||||
public int IntValue { get; set; } | ||||
public string StringValue { get; set; } | ||||
} | ||||
public class Container<T> { | ||||
public Container() { | ||||
} | ||||
public Container(T instance) { | ||||
Instance = instance; | ||||
} | ||||
public T Instance { get; set; } | ||||
} | ||||
cin
|
r255 | |||
cin
|
r229 | public class Program { | ||
cin
|
r255 | static void Main(string[] args) { | ||
cin
|
r267 | var container = new UnityContainer(); | ||
cin
|
r255 | |||
cin
|
r268 | var listener = new SimpleTraceListener(Console.Out); | ||
Trace<ConfigurationContext>.TraceSource.Switch.Level = SourceLevels.All; | ||||
Trace<ConfigurationContext>.TraceSource.Listeners.Add(listener); | ||||
var c = new Container<int>(); | ||||
cin
|
r233 | |||
cin
|
r268 | var cts = new ConfigurationContext(); | ||
cts.AddNamespace("System"); | ||||
cts.AddNamespace("System.Collections.Generic"); | ||||
cts.AddNamespace("Implab.Playground"); | ||||
Console.WriteLine(c.GetType().FullName); | ||||
cts.Resolve("Container{Int32}"); | ||||
cin
|
r233 | } | ||
cin
|
r229 | |||
} | ||||
} | ||||