annotate Implab.Playground/Program.cs @ 270:ade80d94dfb5 v3

Working on Unity container xml configuration
author cin
date Wed, 25 Apr 2018 04:44:40 +0300
parents ff581cff7003
children d4d437ec4483
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
269
ff581cff7003 Working on Unity container xml configuration
cin
parents: 268
diff changeset
46 var conf = SerializationHelpers.DeserializeFromFile<ContainerElement>("data/sample.xml");
233
d6fe09f5592c Improved AsyncQueue
cin
parents: 229
diff changeset
47
270
ade80d94dfb5 Working on Unity container xml configuration
cin
parents: 269
diff changeset
48 Console.WriteLine($"Registrations: {conf.Items.Count}");
268
0be8a6ae8307 Implemented typereference parser
cin
parents: 267
diff changeset
49
233
d6fe09f5592c Improved AsyncQueue
cin
parents: 229
diff changeset
50 }
229
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 }
5f7a3e1d32b9 JsonXmlReader performance tuning
cin
parents:
diff changeset
54 }