Esempio n. 1
0
        public static BindingBuilder <T> InSingletonScope <T>(this BindingBuilder <T> builder)
        {
            builder.CheckBound(true);
            var binding = new SingletonBinding(builder.Binding);

            return(builder.SetBinding(binding.Get));
        }
Esempio n. 2
0
        public static BindingBuilder <T> Bind <T>(this IKernel kernel)
        {
            var builder = new BindingBuilder <T>();

            kernel.Bind(typeof(T), builder.Get);
            return(builder);
        }
Esempio n. 3
0
 // For syntax compatibility with NInject
 public static BindingBuilder <T> ToConstructor <T>(this BindingBuilder <T> builder, Func <IGetKernel, T> method)
 {
     return(ToMethod(builder, method));
 }
Esempio n. 4
0
 public static BindingBuilder <T> ToMethod <T>(this BindingBuilder <T> builder, Func <IGetKernel, T> method)
 {
     builder.CheckBound(false);
     return(builder.SetBinding(c => method(c)));
 }
Esempio n. 5
0
 public static BindingBuilder <T> ToSelf <T>(this BindingBuilder <T> builder)
 {
     return(builder.To <T>());
 }
Esempio n. 6
0
 public static void ToConstant <T>(this BindingBuilder <T> builder, T value)
 {
     builder.CheckBound(false);
     builder.SetBinding(c => value);
 }
Esempio n. 7
0
 private static BindingBuilder <T> SetBinding <T>(this BindingBuilder <T> builder, Binding binding)
 {
     builder.Binding = binding;
     return(builder);
 }