Mercurial > pub > ImplabNet
diff Implab.Playground/Program.cs @ 267:6b3e5c48131b v3
Working on Unity xml configuration
author | cin |
---|---|
date | Fri, 20 Apr 2018 19:05:12 +0300 |
parents | 547a2fc0d93e |
children | 0be8a6ae8307 |
line wrap: on
line diff
--- a/Implab.Playground/Program.cs Mon Apr 16 19:45:18 2018 +0300 +++ b/Implab.Playground/Program.cs Fri Apr 20 19:05:12 2018 +0300 @@ -1,54 +1,40 @@ -using Implab.Diagnostics; -using Implab.Formats.Json; -using Implab.Parallels; +using System; +using Implab.ServiceHost.Unity; using Implab.Xml; -using System; -using System.Collections.Concurrent; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Text; -using System.Threading; -using System.Threading.Tasks; -using System.Xml; -using System.Xml.Serialization; +using Unity; +using Unity.Injection; namespace Implab.Playground { - using System.Diagnostics; - using static Trace<Program>; + + public class Foo { + 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; } + } public class Program { static void Main(string[] args) { - var listener = new SimpleTraceListener(Console.Out); - - var source = Trace<Program>.TraceSource; - source.Switch.Level = SourceLevels.All; - - source.Listeners.Add(listener); + var container = new UnityContainer(); - var t = Environment.TickCount; + var containerConfig = SerializationHelpers.DeserializeFromFile<ContainerElement>("data/sample.xml"); - Main().Wait(); - - Console.WriteLine($"Done: {Environment.TickCount - t} ms"); - Console.ReadKey(); + Console.WriteLine($"container: {containerConfig.Registrations.Count}"); } - static async Task Main() { - using (LogicalOperation(nameof(Main))) { - Log("Start"); - await SomeAsync(); - Log("End"); - } - } - static async Task SomeAsync() { - using (LogicalOperation(nameof(SomeAsync))) { - Log("Do prepare"); - await Task.Yield(); - Log("Yield"); - } - } } }