Mercurial > pub > ImplabNet
diff Implab.Playground/Program.cs @ 273:79110a16cab7 v3
Working on Unity xml configuration: Refactoring in progress
author | cin |
---|---|
date | Thu, 26 Apr 2018 19:35:01 +0300 |
parents | 9d1cca834b05 |
children | 22629bf26121 |
line wrap: on
line diff
--- a/Implab.Playground/Program.cs Thu Apr 26 03:14:54 2018 +0300 +++ b/Implab.Playground/Program.cs Thu Apr 26 19:35:01 2018 +0300 @@ -47,19 +47,28 @@ public class Program { static void Main(string[] args) { - var container = new UnityContainer(); + var stopwatch = new Stopwatch(); + stopwatch.Start(); - var ctx = new ConfigurationContext(container); + var ctx = new ContainerContext(); + + Console.WriteLine($"Created: {stopwatch.ElapsedMilliseconds}"); + + ctx.LoadConfig("data/sample.xml"); - var conf = SerializationHelpers.DeserializeFromFile<ContainerElement>("data/sample.xml"); + Console.WriteLine($"Loaded: {stopwatch.ElapsedMilliseconds}"); + + var container = ctx.Container; + + - ctx.Visit(conf); + var instace1 = container.Resolve<IContainer<string>>(); + Console.WriteLine($"Resolved1: {stopwatch.ElapsedMilliseconds}"); + var instace2 = container.Resolve<IContainer<Foo>>(); + + Console.WriteLine($"Resolved2: {stopwatch.ElapsedMilliseconds}"); DisplayContainerRegistrations(container); - - var instace1 = container.Resolve<IContainer<string>>(); - var instace2 = container.Resolve<IContainer<Foo>>(); - } static void DisplayContainerRegistrations(IUnityContainer theContainer) {