Well, this question is pretty simply stated by the title.
For a local variable factory:
var factory = Fluently.Configure() ... Are these two lines equivalent:
Bind<ISessionFactory>().ToConstant(factory).InSingletonScope(); and:
Bind<ISessionFactory>().ToConstant(factory); In the latest version of ninject, when you create a ToConstant binding it will automatically set the Scope to Singleton. Thus, the InSingletonScope() part in your example is redundant. From ninject code base:
    /// <summary>     /// Indicates that the service should be bound to the specified constant value.     /// </summary>     /// <param name="value">The constant value.</param>     public IBindingWhenInNamedWithOrOnSyntax<T> ToConstant(T value)     {         Binding.ProviderCallback = ctx => new ConstantProvider<T>(value);         Binding.Target = BindingTarget.Constant;         Binding.ScopeCallback = StandardScopeCallbacks.Singleton;          return this;     } If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With