|
|
|
@ -30,12 +30,7 @@ namespace Perspex |
|
|
|
public object GetService(Type t) |
|
|
|
{ |
|
|
|
Func<object> rv; |
|
|
|
if (_registry.TryGetValue(t, out rv)) |
|
|
|
return rv(); |
|
|
|
var parentRv = _parentScope?.GetService(t); |
|
|
|
if (parentRv != null) |
|
|
|
return parentRv; |
|
|
|
throw new TypeLoadException("Unable to find registrations for service " + t); |
|
|
|
return _registry.TryGetValue(t, out rv) ? rv() : _parentScope?.GetService(t); |
|
|
|
} |
|
|
|
|
|
|
|
public class RegistrationHelper<TService> |
|
|
|
@ -94,11 +89,24 @@ namespace Perspex |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
class NullDisposable : IDisposable |
|
|
|
{ |
|
|
|
public void Dispose() |
|
|
|
{ |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public static IDisposable EnterScope() |
|
|
|
{ |
|
|
|
return new NullDisposable(); |
|
|
|
|
|
|
|
//Switch to that code when we are ready to fix tests
|
|
|
|
/* |
|
|
|
var d = new ResolverDisposable(Current, CurrentMutable); |
|
|
|
Current = CurrentMutable = new PerspexLocator(Current); |
|
|
|
return d; |
|
|
|
*/ |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|