Skip to content

Instantly share code, notes, and snippets.

@juanplopes
Forked from vquaiato/MeuDependencyResolver.cs
Created February 1, 2011 18:17
Show Gist options
  • Select an option

  • Save juanplopes/806307 to your computer and use it in GitHub Desktop.

Select an option

Save juanplopes/806307 to your computer and use it in GitHub Desktop.
public class MeuDependencyResolver : IDependencyResolver
{
private ILookup<Type, object> lookup;
public MeuDependencyResolver()
{
var dependencias = new []
{
new DummyDependencia1(), new DummyDependencia2(), new DummyDependencia2_2()
};
this.lookup = 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