public void From <TImplementation>(string identifier) where TImplementation : T { var existingBinding = ConfigurationKernel.Resolve(typeof(T), identifier, _context); if (existingBinding.IsInstance()) { ConfigurationKernel.Unbind(typeof(T), new ScopeContext(typeof(TImplementation), new ContextProviders.ScopeContext(_context)), identifier); } }
/// <summary> /// Binds an implementation to its base class or interface /// </summary> public IScopeContext To(Type type, string identifier = "default") { var existingBinding = ConfigurationKernel.Resolve(ConcreteType, identifier, true); if (existingBinding.IsInstance() && !existingBinding.IsNull) { return(existingBinding); } existingBinding = type.ConvertToContext(); ConfigurationKernel.Bind(ConcreteType, existingBinding, identifier); return(existingBinding); }
private IResolveContext <T> FindServiceImplementation <T>(string named) { return(new ResolveContext <T>((IScopeContextInternal)KernelResolver.Resolve(typeof(T), named, this), _scopeContext)); }