Mercurial > pub > ImplabNet
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 |
| 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 |
| 271 | 46 var ctx = new ConfigurationContext(container); |
| 47 | |
| 269 | 48 var conf = SerializationHelpers.DeserializeFromFile<ContainerElement>("data/sample.xml"); |
| 233 | 49 |
| 271 | 50 ctx.Visit(conf); |
| 51 | |
| 270 | 52 Console.WriteLine($"Registrations: {conf.Items.Count}"); |
| 268 | 53 |
| 233 | 54 } |
| 229 | 55 |
| 56 | |
| 57 } | |
| 58 } |
