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
92 Views
no comments
 
C#
/* 
 * Escrito por Jone Polvora - jpolvora@gmail.com
 * Julho2011
 * Novidades: Convenção para resolver interfaces (IClasse, Classe)
 * Resolver por String
 * Resolver com parâmetros
 * Escopo de registro
 * Objetos registrados com WeakReference
 */
 
by Jone   August 01, 2011 @ 10:47pm
97 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
328 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
195 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
165 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
933 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
685 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