##// END OF EJS Templates
container configuration docs
container configuration docs

File last commit:

r274:22629bf26121 v3
r276:b4e0f81c7425 v3
Show More
Program.cs
95 lines | 2.6 KiB | text/x-csharp | CSharpLexer
cin
Working on Unity xml configuration
r267 using System;
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
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
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
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}");
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
Improved AsyncQueue...
r233
cin
Working on Unity xml configuration: Refactoring in progress
r273 var instace1 = container.Resolve<IContainer<string>>();
Console.WriteLine($"Resolved1: {stopwatch.ElapsedMilliseconds}");
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
}
}