annotate Implab.Playground/Program.cs @ 271:d4d437ec4483 v3

Working on Unity xml configuration
author cin
date Wed, 25 Apr 2018 19:23:35 +0300
parents ade80d94dfb5
children 9d1cca834b05
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 {
269
ff581cff7003 Working on Unity container xml configuration
cin
parents: 268
diff changeset
12
ff581cff7003 Working on Unity container xml configuration
cin
parents: 268
diff changeset
13 public class Bar {
ff581cff7003 Working on Unity container xml configuration
cin
parents: 268
diff changeset
14
ff581cff7003 Working on Unity container xml configuration
cin
parents: 268
diff changeset
15 }
ff581cff7003 Working on Unity container xml configuration
cin
parents: 268
diff changeset
16
270
ade80d94dfb5 Working on Unity container xml configuration
cin
parents: 269
diff changeset
17 public string Name { get; set; }
ade80d94dfb5 Working on Unity container xml configuration
cin
parents: 269
diff changeset
18
267
6b3e5c48131b Working on Unity xml configuration
cin
parents: 260
diff changeset
19 public int IntValue { get; set; }
6b3e5c48131b Working on Unity xml configuration
cin
parents: 260
diff changeset
20
6b3e5c48131b Working on Unity xml configuration
cin
parents: 260
diff changeset
21 public string StringValue { get; set; }
6b3e5c48131b Working on Unity xml configuration
cin
parents: 260
diff changeset
22
6b3e5c48131b Working on Unity xml configuration
cin
parents: 260
diff changeset
23 }
6b3e5c48131b Working on Unity xml configuration
cin
parents: 260
diff changeset
24
6b3e5c48131b Working on Unity xml configuration
cin
parents: 260
diff changeset
25 public class Container<T> {
6b3e5c48131b Working on Unity xml configuration
cin
parents: 260
diff changeset
26 public Container() {
6b3e5c48131b Working on Unity xml configuration
cin
parents: 260
diff changeset
27
6b3e5c48131b Working on Unity xml configuration
cin
parents: 260
diff changeset
28 }
6b3e5c48131b Working on Unity xml configuration
cin
parents: 260
diff changeset
29
6b3e5c48131b Working on Unity xml configuration
cin
parents: 260
diff changeset
30 public Container(T instance) {
6b3e5c48131b Working on Unity xml configuration
cin
parents: 260
diff changeset
31 Instance = instance;
6b3e5c48131b Working on Unity xml configuration
cin
parents: 260
diff changeset
32 }
6b3e5c48131b Working on Unity xml configuration
cin
parents: 260
diff changeset
33
6b3e5c48131b Working on Unity xml configuration
cin
parents: 260
diff changeset
34 public T Instance { get; set; }
270
ade80d94dfb5 Working on Unity container xml configuration
cin
parents: 269
diff changeset
35
ade80d94dfb5 Working on Unity container xml configuration
cin
parents: 269
diff changeset
36 public void SetInstance(T value) {
ade80d94dfb5 Working on Unity container xml configuration
cin
parents: 269
diff changeset
37 Instance = value;
ade80d94dfb5 Working on Unity container xml configuration
cin
parents: 269
diff changeset
38 }
267
6b3e5c48131b Working on Unity xml configuration
cin
parents: 260
diff changeset
39 }
255
b00441e04738 Adde workaround to the behaviour of the logical operations stack in conjuction
cin
parents: 236
diff changeset
40
229
5f7a3e1d32b9 JsonXmlReader performance tuning
cin
parents:
diff changeset
41 public class Program {
5f7a3e1d32b9 JsonXmlReader performance tuning
cin
parents:
diff changeset
42
255
b00441e04738 Adde workaround to the behaviour of the logical operations stack in conjuction
cin
parents: 236
diff changeset
43 static void Main(string[] args) {
267
6b3e5c48131b Working on Unity xml configuration
cin
parents: 260
diff changeset
44 var container = new UnityContainer();
255
b00441e04738 Adde workaround to the behaviour of the logical operations stack in conjuction
cin
parents: 236
diff changeset
45
271
d4d437ec4483 Working on Unity xml configuration
cin
parents: 270
diff changeset
46 var ctx = new ConfigurationContext(container);
d4d437ec4483 Working on Unity xml configuration
cin
parents: 270
diff changeset
47
269
ff581cff7003 Working on Unity container xml configuration
cin
parents: 268
diff changeset
48 var conf = SerializationHelpers.DeserializeFromFile<ContainerElement>("data/sample.xml");
233
d6fe09f5592c Improved AsyncQueue
cin
parents: 229
diff changeset
49
271
d4d437ec4483 Working on Unity xml configuration
cin
parents: 270
diff changeset
50 ctx.Visit(conf);
d4d437ec4483 Working on Unity xml configuration
cin
parents: 270
diff changeset
51
270
ade80d94dfb5 Working on Unity container xml configuration
cin
parents: 269
diff changeset
52 Console.WriteLine($"Registrations: {conf.Items.Count}");
268
0be8a6ae8307 Implemented typereference parser
cin
parents: 267
diff changeset
53
233
d6fe09f5592c Improved AsyncQueue
cin
parents: 229
diff changeset
54 }
229
5f7a3e1d32b9 JsonXmlReader performance tuning
cin
parents:
diff changeset
55
5f7a3e1d32b9 JsonXmlReader performance tuning
cin
parents:
diff changeset
56
5f7a3e1d32b9 JsonXmlReader performance tuning
cin
parents:
diff changeset
57 }
5f7a3e1d32b9 JsonXmlReader performance tuning
cin
parents:
diff changeset
58 }