Mercurial > pub > ImplabNet
annotate Implab.Playground/Program.cs @ 268:0be8a6ae8307 v3
Implemented typereference parser
| author | cin | 
|---|---|
| date | Sun, 22 Apr 2018 15:29:10 +0300 | 
| parents | 6b3e5c48131b | 
| children | ff581cff7003 | 
| rev | line source | 
|---|---|
| 267 | 1 using System; | 
| 268 | 2 using System.Diagnostics; | 
| 3 using Implab.Diagnostics; | |
| 267 | 4 using Implab.ServiceHost.Unity; | 
| 229 | 5 using Implab.Xml; | 
| 267 | 6 using Unity; | 
| 7 using Unity.Injection; | |
| 229 | 8 | 
| 9 namespace Implab.Playground { | |
| 267 | 10 | 
| 11 public class Foo { | |
| 12 public int IntValue { get; set; } | |
| 13 | |
| 14 public string StringValue { get; set; } | |
| 15 | |
| 16 } | |
| 17 | |
| 18 public class Container<T> { | |
| 19 public Container() { | |
| 20 | |
| 21 } | |
| 22 | |
| 23 public Container(T instance) { | |
| 24 Instance = instance; | |
| 25 } | |
| 26 | |
| 27 public T Instance { get; set; } | |
| 28 } | |
| 
255
 
b00441e04738
Adde workaround to the behaviour of the logical operations stack in conjuction
 
cin 
parents: 
236 
diff
changeset
 | 
29 | 
| 229 | 30 public class Program { | 
| 31 | |
| 
255
 
b00441e04738
Adde workaround to the behaviour of the logical operations stack in conjuction
 
cin 
parents: 
236 
diff
changeset
 | 
32 static void Main(string[] args) { | 
| 267 | 33 var container = new UnityContainer(); | 
| 
255
 
b00441e04738
Adde workaround to the behaviour of the logical operations stack in conjuction
 
cin 
parents: 
236 
diff
changeset
 | 
34 | 
| 268 | 35 var listener = new SimpleTraceListener(Console.Out); | 
| 36 Trace<ConfigurationContext>.TraceSource.Switch.Level = SourceLevels.All; | |
| 37 Trace<ConfigurationContext>.TraceSource.Listeners.Add(listener); | |
| 38 | |
| 39 var c = new Container<int>(); | |
| 233 | 40 | 
| 268 | 41 var cts = new ConfigurationContext(); | 
| 42 cts.AddNamespace("System"); | |
| 43 cts.AddNamespace("System.Collections.Generic"); | |
| 44 cts.AddNamespace("Implab.Playground"); | |
| 45 | |
| 46 Console.WriteLine(c.GetType().FullName); | |
| 47 | |
| 48 cts.Resolve("Container{Int32}"); | |
| 233 | 49 } | 
| 229 | 50 | 
| 51 | |
| 52 } | |
| 53 } | 
