/// <summary> /// Indicates that the service should be bound to the specified type. /// </summary> /// <param name="service">The specified service type.</param> /// <param name="typeTo">The specified to type</param> /// <param name="name">The specified binding name.</param> /// <param name="dependencyLifecycle"> /// The specified <see cref="DependencyLifecycle" /> /// </param> public void Bind(Type service, Type typeTo, DependencyLifecycle dependencyLifecycle, string name = null) { this.NotBeDisposed(); Should.NotBeNull(service, "service"); Should.NotBeNull(typeTo, "typeTo"); ITypeCallbackConstructorObjectPriorityUseWithSyntax syntax = _injector .BindWithManualBuild(service) .To(typeTo) .InScope(GetScope(dependencyLifecycle)); if (name != null) { syntax.NamedBinding(name); } syntax.Build(); }
public void Bind(Type service, Type typeTo, DependencyLifecycle dependencyLifecycle, string name = null, params IIocParameter[] parameters) { this.NotBeDisposed(); Should.NotBeNull(service, "service"); Should.NotBeNull(typeTo, "typeTo"); ITypeCallbackConstructorObjectPriorityUseWithSyntax syntax = _injector.BindWithManualBuild(service).To(typeTo).InScope(GetScope(dependencyLifecycle)); if (parameters != null) { for (int index = 0; index < parameters.Length; index++) { syntax.WithParameter(ConvertParameter(parameters[index], true)); } } if (name != null) { syntax.NamedBinding(name); } syntax.Build(); }