Skip to content

Instantly share code, notes, and snippets.

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