Mercurial > pub > ImplabNet
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 |
rev | line source |
---|---|
267 | 1 using System; |
268 | 2 using System.Diagnostics; |
3 using Implab.Diagnostics; | |
267 | 4 using Implab.ServiceHost.Unity; |
229 | 5 using Implab.Xml; |
267 | 6 using Unity; |
7 using Unity.Injection; | |
229 | 8 |
9 namespace Implab.Playground { | |
267 | 10 |
11 public class Foo { | |
269 | 12 |
13 public class Bar { | |
14 | |
15 } | |
16 | |
270 | 17 public string Name { get; set; } |
18 | |
267 | 19 public int IntValue { get; set; } |
20 | |
21 public string StringValue { get; set; } | |
22 | |
23 } | |
24 | |
25 public class Container<T> { | |
26 public Container() { | |
27 | |
28 } | |
29 | |
30 public Container(T instance) { | |
31 Instance = instance; | |
32 } | |
33 | |
34 public T Instance { get; set; } | |
270 | 35 |
36 public void SetInstance(T value) { | |
37 Instance = value; | |
38 } | |
267 | 39 } |
255
b00441e04738
Adde workaround to the behaviour of the logical operations stack in conjuction
cin
parents:
236
diff
changeset
|
40 |
229 | 41 public class Program { |
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 | 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 | 46 var conf = SerializationHelpers.DeserializeFromFile<ContainerElement>("data/sample.xml"); |
233 | 47 |
270 | 48 Console.WriteLine($"Registrations: {conf.Items.Count}"); |
268 | 49 |
233 | 50 } |
229 | 51 |
52 | |
53 } | |
54 } |