CodePaste Logo
New Snippet New Snippet Recent Snippets Recent Snippets My Snippets My Snippets Web Code Search Snippets Search
Sign inor Register
Format:
Recent snippets matching tags of IoC
C#
public static class UnityContainerExtensions
{
    public static void AssertMappingsAreValid(this IUnityContainer container)
    {            
        foreach (var registration in container.Registrations)
        {
            container.Resolve(registration.RegisteredType, registration.Name);
        }
    }
}
by Byteflux   October 04, 2011 @ 10:36pm
140 Views
no comments
 
C#
using System;
using System.Collections.Generic;
 
namespace UltraLight
{
    public class RegistrationInfo
    {
        private readonly object _lock = new object();
        private readonly UltraLightContainer _container;
        private readonly Type _concrete;
by Jone   August 01, 2011 @ 10:47pm
124 Views
no comments
 
C#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
 
public class SimpleContainer 
{
    readonly List<ContainerEntry> entries = new List<ContainerEntry>();
 
    public void RegisterInstance(Type service, string key, object implementation)
by Rob Eisenberg   July 25, 2010 @ 12:06pm
366 Views
1 comments
 
C#
public class Container
{
  private readonly Dictionary<Type, object> repository = new Dictionary<Type, object>();
 
 
  public void Register<T>(Func<T> builderFunc)
  {
    repository.Add(typeof (T), builderFunc);
  }
by Philipp Sumi   May 14, 2010 @ 3:42pm
Tags: IOC
221 Views
no comments
 
C#
public class OrderProcessor : IOrderProcessor
{
    public OrderProcessor(IOrderValidator orderValidator, IOrderShipper orderShipper)
    {
        _orderValidator = orderValidator;
        _orderShipper = orderShipper;
    }
    
    public void Process(Order order)
    {
by Andy Sherwood   February 04, 2010 @ 10:37am
183 Views
no comments
 
C#
class Program
{
    static void Main(string[] args)
    {
        var instance = new Program();
        var cat = new AssemblyCatalog(typeof(Program).Assembly);
        var container = new CompositionContainer(cat);
        container.ComposeParts(instance);
 
        foreach (var plug in instance.Plugins)
by bnaya   January 29, 2010 @ 4:10am
1060 Views
no comments
 
C#
class Program
{
    private static ImpCls s_imp = new ImpCls();
    private static string[] s_beforeState;
 
    static void Main(string[] args)
    {
        var c = new TypeCatalog(typeof(ExpMtd1));
        var catalog = new AggregateCatalog(c);
        var container = new CompositionContainer(catalog);
by bnaya   January 15, 2010 @ 1:17am
1036 Views
no comments
 
brought to you by:
West Wind Techologies



If you find this site useful and use it frequently please consider making a donation to support this free service.
Donate