comparison 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
comparison
equal deleted inserted replaced
267:6b3e5c48131b 268:0be8a6ae8307
1 using System; 1 using System;
2 using System.Diagnostics;
3 using Implab.Diagnostics;
2 using Implab.ServiceHost.Unity; 4 using Implab.ServiceHost.Unity;
3 using Implab.Xml; 5 using Implab.Xml;
4 using Unity; 6 using Unity;
5 using Unity.Injection; 7 using Unity.Injection;
6 8
28 public class Program { 30 public class Program {
29 31
30 static void Main(string[] args) { 32 static void Main(string[] args) {
31 var container = new UnityContainer(); 33 var container = new UnityContainer();
32 34
33 var containerConfig = SerializationHelpers.DeserializeFromFile<ContainerElement>("data/sample.xml"); 35 var listener = new SimpleTraceListener(Console.Out);
36 Trace<ConfigurationContext>.TraceSource.Switch.Level = SourceLevels.All;
37 Trace<ConfigurationContext>.TraceSource.Listeners.Add(listener);
34 38
35 Console.WriteLine($"container: {containerConfig.Registrations.Count}"); 39 var c = new Container<int>();
40
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}");
36 } 49 }
37 50
38 51
39 } 52 }
40 } 53 }