Skip to content

Instantly share code, notes, and snippets.

@vquaiato
Forked from juanplopes/MeuDependencyResolver.cs
Created February 1, 2011 18:13
Show Gist options
  • Save vquaiato/806303 to your computer and use it in GitHub Desktop.
Save vquaiato/806303 to your computer and use it in GitHub Desktop.
public class MeuDependencyResolver : IDependencyResolver
{
private ILookup<Type, object> lookup;
private HashSet<object> dependencias = new HashSet<object>();
public MeuDependencyResolver()
{
this.dependencias.Add(new DummyDependencia1());
this.dependencias.Add(new DummyDependencia2());
this.dependencias.Add(new DummyDependencia2_2());
this.lookup = this.dependencias.ToLookup(x => x.GetType());
}
public object GetService(Type serviceType)
{
return lookup[serviceType].FirstOrDefault();
}
public IEnumerable<object> GetServices(Type serviceType)
{
return lookup[serviceType];
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment