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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
267
6b3e5c48131b Working on Unity xml configuration
cin
parents: 260
diff changeset
1 using System;
268
0be8a6ae8307 Implemented typereference parser
cin
parents: 267
diff changeset
2 using System.Diagnostics;
0be8a6ae8307 Implemented typereference parser
cin
parents: 267
diff changeset
3 using Implab.Diagnostics;
267
6b3e5c48131b Working on Unity xml configuration
cin
parents: 260
diff changeset
4 using Implab.ServiceHost.Unity;
229
5f7a3e1d32b9 JsonXmlReader performance tuning
cin
parents:
diff changeset
5 using Implab.Xml;
267
6b3e5c48131b Working on Unity xml configuration
cin
parents: 260
diff changeset
6 using Unity;
6b3e5c48131b Working on Unity xml configuration
cin
parents: 260
diff changeset
7 using Unity.Injection;
229
5f7a3e1d32b9 JsonXmlReader performance tuning
cin
parents:
diff changeset
8
5f7a3e1d32b9 JsonXmlReader performance tuning
cin
parents:
diff changeset
9 namespace Implab.Playground {
267
6b3e5c48131b Working on Unity xml configuration
cin
parents: 260
diff changeset
10
6b3e5c48131b Working on Unity xml configuration
cin
parents: 260
diff changeset
11 public class Foo {
6b3e5c48131b Working on Unity xml configuration
cin
parents: 260
diff changeset
12 public int IntValue { get; set; }
6b3e5c48131b Working on Unity xml configuration
cin
parents: 260
diff changeset
13
6b3e5c48131b Working on Unity xml configuration
cin
parents: 260
diff changeset
14 public string StringValue { get; set; }
6b3e5c48131b Working on Unity xml configuration
cin
parents: 260
diff changeset
15
6b3e5c48131b Working on Unity xml configuration
cin
parents: 260
diff changeset
16 }
6b3e5c48131b Working on Unity xml configuration
cin
parents: 260
diff changeset
17
6b3e5c48131b Working on Unity xml configuration
cin
parents: 260
diff changeset
18 public class Container<T> {
6b3e5c48131b Working on Unity xml configuration
cin
parents: 260
diff changeset
19 public Container() {
6b3e5c48131b Working on Unity xml configuration
cin
parents: 260
diff changeset
20
6b3e5c48131b Working on Unity xml configuration
cin
parents: 260
diff changeset
21 }
6b3e5c48131b Working on Unity xml configuration
cin
parents: 260
diff changeset
22
6b3e5c48131b Working on Unity xml configuration
cin
parents: 260
diff changeset
23 public Container(T instance) {
6b3e5c48131b Working on Unity xml configuration
cin
parents: 260
diff changeset
24 Instance = instance;
6b3e5c48131b Working on Unity xml configuration
cin
parents: 260
diff changeset
25 }
6b3e5c48131b Working on Unity xml configuration
cin
parents: 260
diff changeset
26
6b3e5c48131b Working on Unity xml configuration
cin
parents: 260
diff changeset
27 public T Instance { get; set; }
6b3e5c48131b Working on Unity xml configuration
cin
parents: 260
diff changeset
28 }
255
b00441e04738 Adde workaround to the behaviour of the logical operations stack in conjuction
cin
parents: 236
diff changeset
29
229
5f7a3e1d32b9 JsonXmlReader performance tuning
cin
parents:
diff changeset
30 public class Program {
5f7a3e1d32b9 JsonXmlReader performance tuning
cin
parents:
diff changeset
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
6b3e5c48131b Working on Unity xml configuration
cin
parents: 260
diff changeset
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
0be8a6ae8307 Implemented typereference parser
cin
parents: 267
diff changeset
35 var listener = new SimpleTraceListener(Console.Out);
0be8a6ae8307 Implemented typereference parser
cin
parents: 267
diff changeset
36 Trace<ConfigurationContext>.TraceSource.Switch.Level = SourceLevels.All;
0be8a6ae8307 Implemented typereference parser
cin
parents: 267
diff changeset
37 Trace<ConfigurationContext>.TraceSource.Listeners.Add(listener);
0be8a6ae8307 Implemented typereference parser
cin
parents: 267
diff changeset
38
0be8a6ae8307 Implemented typereference parser
cin
parents: 267
diff changeset
39 var c = new Container<int>();
233
d6fe09f5592c Improved AsyncQueue
cin
parents: 229
diff changeset
40
268
0be8a6ae8307 Implemented typereference parser
cin
parents: 267
diff changeset
41 var cts = new ConfigurationContext();
0be8a6ae8307 Implemented typereference parser
cin
parents: 267
diff changeset
42 cts.AddNamespace("System");
0be8a6ae8307 Implemented typereference parser
cin
parents: 267
diff changeset
43 cts.AddNamespace("System.Collections.Generic");
0be8a6ae8307 Implemented typereference parser
cin
parents: 267
diff changeset
44 cts.AddNamespace("Implab.Playground");
0be8a6ae8307 Implemented typereference parser
cin
parents: 267
diff changeset
45
0be8a6ae8307 Implemented typereference parser
cin
parents: 267
diff changeset
46 Console.WriteLine(c.GetType().FullName);
0be8a6ae8307 Implemented typereference parser
cin
parents: 267
diff changeset
47
0be8a6ae8307 Implemented typereference parser
cin
parents: 267
diff changeset
48 cts.Resolve("Container{Int32}");
233
d6fe09f5592c Improved AsyncQueue
cin
parents: 229
diff changeset
49 }
229
5f7a3e1d32b9 JsonXmlReader performance tuning
cin
parents:
diff changeset
50
5f7a3e1d32b9 JsonXmlReader performance tuning
cin
parents:
diff changeset
51
5f7a3e1d32b9 JsonXmlReader performance tuning
cin
parents:
diff changeset
52 }
5f7a3e1d32b9 JsonXmlReader performance tuning
cin
parents:
diff changeset
53 }