##// END OF EJS Templates
Refactoring...
Refactoring Added <array> element to injection parameters Working on registrations of factories

File last commit:

r277:963b17c275be v3
r277:963b17c275be v3
Show More
Program.cs
114 lines | 3.3 KiB | text/x-csharp | CSharpLexer
cin
Working on Unity xml configuration
r267 using System;
cin
Refactoring...
r277 using System.Collections.Generic;
cin
Implemented typereference parser
r268 using System.Diagnostics;
cin
preview version of Unity xml configuration
r272 using System.Linq;
cin
Implemented typereference parser
r268 using Implab.Diagnostics;
cin
Working on Unity xml configuration
r267 using Implab.ServiceHost.Unity;
cin
JsonXmlReader performance tuning...
r229 using Implab.Xml;
cin
Working on Unity xml configuration
r267 using Unity;
using Unity.Injection;
cin
preview version of Unity xml configuration
r272 using Unity.Registration;
cin
JsonXmlReader performance tuning...
r229
namespace Implab.Playground {
cin
Working on Unity xml configuration
r267
public class Foo {
cin
Working on Unity container xml configuration
r269
public class Bar {
}
cin
Working on Unity container xml configuration
r270 public string Name { get; set; }
cin
Working on Unity xml configuration
r267 public int IntValue { get; set; }
public string StringValue { get; set; }
cin
Refactoring...
r277 public void AddRange(Foo[] items) {
Console.WriteLine($"AddRange: Foo[]");
}
cin
Working on Unity xml configuration
r267 }
cin
preview version of Unity xml configuration
r272 public interface IContainer<T> {
T Instance { get; set; }
}
public class Container<T> : IContainer<T> {
cin
Working on Unity xml configuration
r267 public Container() {
}
public Container(T instance) {
Instance = instance;
}
public T Instance { get; set; }
cin
Working on Unity container xml configuration
r270
public void SetInstance(T value) {
Instance = value;
}
cin
Refactoring...
r277
public void AddRange(List<T> items) {
Console.WriteLine($"AddRange: {typeof(List<T>)}");
}
public void AddRange(T[] items) {
Console.WriteLine($"AddRange: T[] ofType {typeof(T[])}");
}
cin
Working on Unity xml configuration
r267 }
cin
Adde workaround to the behaviour of the logical operations stack in conjuction...
r255
cin
JsonXmlReader performance tuning...
r229 public class Program {
cin
Adde workaround to the behaviour of the logical operations stack in conjuction...
r255 static void Main(string[] args) {
cin
Refactoring...
r277 var listener = new SimpleTraceListener(Console.Out);
var source = Trace<TypeResolver>.TraceSource;
source.Switch.Level = SourceLevels.All;
source.Listeners.Add(listener);
cin
Working on Unity xml configuration: Refactoring in progress
r273 var stopwatch = new Stopwatch();
stopwatch.Start();
cin
Adde workaround to the behaviour of the logical operations stack in conjuction...
r255
cin
Unity xml configuration, alpha2
r274 var ctx = new ContainerBuilder();
cin
Working on Unity xml configuration: Refactoring in progress
r273
Console.WriteLine($"Created: {stopwatch.ElapsedMilliseconds}");
cin
Refactoring...
r277 stopwatch.Restart();
cin
Working on Unity xml configuration: Refactoring in progress
r273 ctx.LoadConfig("data/sample.xml");
cin
Working on Unity xml configuration
r271
cin
Working on Unity xml configuration: Refactoring in progress
r273 Console.WriteLine($"Loaded: {stopwatch.ElapsedMilliseconds}");
var container = ctx.Container;
cin
Refactoring...
r277 stopwatch.Restart();
cin
Working on Unity xml configuration: Refactoring in progress
r273 var instace1 = container.Resolve<IContainer<string>>();
Console.WriteLine($"Resolved1: {stopwatch.ElapsedMilliseconds}");
cin
Refactoring...
r277
stopwatch.Restart();
cin
Working on Unity xml configuration: Refactoring in progress
r273 var instace2 = container.Resolve<IContainer<Foo>>();
Console.WriteLine($"Resolved2: {stopwatch.ElapsedMilliseconds}");
cin
Working on Unity xml configuration
r271
cin
preview version of Unity xml configuration
r272 DisplayContainerRegistrations(container);
}
cin
Implemented typereference parser
r268
cin
preview version of Unity xml configuration
r272 static void DisplayContainerRegistrations(IUnityContainer theContainer) {
string regName, regType, mapTo, lifetime;
Console.WriteLine("Container has {0} Registrations:",
theContainer.Registrations.Count());
foreach (ContainerRegistration item in theContainer.Registrations) {
regType = item.RegisteredType.FullName;
mapTo = item.MappedToType.FullName;
regName = item.Name ?? "[default]";
lifetime = item.LifetimeManager.LifetimeType.Name;
if (mapTo != regType) {
mapTo = " -> " + mapTo;
} else {
mapTo = string.Empty;
}
lifetime = lifetime.Substring(0, lifetime.Length - "LifetimeManager".Length);
Console.WriteLine("+ {0}{1} '{2}' {3}", regType, mapTo, regName, lifetime);
}
cin
Improved AsyncQueue...
r233 }
cin
JsonXmlReader performance tuning...
r229
}
}