protected override Ninject.Activation.IContext CreateContext(Ninject.Activation.IRequest request, Ninject.Planning.Bindings.IBinding binding) { var isBaseViewModel = binding.Service.IsSubclassOf(typeof(BaseViewModel)); binding.ScopeCallback = isBaseViewModel ? StandardScopeCallbacks.Transient : StandardScopeCallbacks.Singleton; return(base.CreateContext(request, binding)); }
private static bool HasAncestorAssignableFrom <T>(IRequest request) { while (true) { if (request == null) { return(false); } if (typeof(T).IsAssignableFrom(request.Service)) { return(true); } request = request.ParentRequest; } }
public System.Collections.Generic.IEnumerable <object> Resolve(Ninject.Activation.IRequest request) { throw new System.NotImplementedException(); }
public bool CanResolve(Ninject.Activation.IRequest request) { throw new System.NotImplementedException(); }
private static bool DoesNotHaveAncestorAssignableFrom <T>(IRequest request) { return(!HasAncestorAssignableFrom <T>(request)); }