comparison Implab.Playground/Program.cs @ 269:ff581cff7003 v3

Working on Unity container xml configuration
author cin
date Tue, 24 Apr 2018 01:46:02 +0300
parents 0be8a6ae8307
children ade80d94dfb5
comparison
equal deleted inserted replaced
268:0be8a6ae8307 269:ff581cff7003
7 using Unity.Injection; 7 using Unity.Injection;
8 8
9 namespace Implab.Playground { 9 namespace Implab.Playground {
10 10
11 public class Foo { 11 public class Foo {
12
13 public class Bar {
14
15 }
16
12 public int IntValue { get; set; } 17 public int IntValue { get; set; }
13 18
14 public string StringValue { get; set; } 19 public string StringValue { get; set; }
15 20
16 } 21 }
30 public class Program { 35 public class Program {
31 36
32 static void Main(string[] args) { 37 static void Main(string[] args) {
33 var container = new UnityContainer(); 38 var container = new UnityContainer();
34 39
35 var listener = new SimpleTraceListener(Console.Out); 40 var conf = SerializationHelpers.DeserializeFromFile<ContainerElement>("data/sample.xml");
36 Trace<ConfigurationContext>.TraceSource.Switch.Level = SourceLevels.All;
37 Trace<ConfigurationContext>.TraceSource.Listeners.Add(listener);
38 41
39 var c = new Container<int>(); 42 Console.WriteLine($"Registrations: {conf.Registrations.Count}");
40 43
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}");
49 } 44 }
50 45
51 46
52 } 47 }
53 } 48 }