-
-
Save vquaiato/806303 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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