Program.cs
58 lines
| 1.1 KiB
| text/x-csharp
|
CSharpLexer
/ Implab.Playground / Program.cs
cin
|
r267 | using System; | ||
cin
|
r268 | using System.Diagnostics; | ||
using Implab.Diagnostics; | ||||
cin
|
r267 | using Implab.ServiceHost.Unity; | ||
cin
|
r229 | using Implab.Xml; | ||
cin
|
r267 | using Unity; | ||
using Unity.Injection; | ||||
cin
|
r229 | |||
namespace Implab.Playground { | ||||
cin
|
r267 | |||
public class Foo { | ||||
cin
|
r269 | |||
public class Bar { | ||||
} | ||||
cin
|
r270 | public string Name { get; set; } | ||
cin
|
r267 | public int IntValue { get; set; } | ||
public string StringValue { get; set; } | ||||
} | ||||
public class Container<T> { | ||||
public Container() { | ||||
} | ||||
public Container(T instance) { | ||||
Instance = instance; | ||||
} | ||||
public T Instance { get; set; } | ||||
cin
|
r270 | |||
public void SetInstance(T value) { | ||||
Instance = value; | ||||
} | ||||
cin
|
r267 | } | ||
cin
|
r255 | |||
cin
|
r229 | public class Program { | ||
cin
|
r255 | static void Main(string[] args) { | ||
cin
|
r267 | var container = new UnityContainer(); | ||
cin
|
r255 | |||
cin
|
r271 | var ctx = new ConfigurationContext(container); | ||
cin
|
r269 | var conf = SerializationHelpers.DeserializeFromFile<ContainerElement>("data/sample.xml"); | ||
cin
|
r233 | |||
cin
|
r271 | ctx.Visit(conf); | ||
cin
|
r270 | Console.WriteLine($"Registrations: {conf.Items.Count}"); | ||
cin
|
r268 | |||
cin
|
r233 | } | ||
cin
|
r229 | |||
} | ||||
} | ||||