Beispiel #1
0
        public static object Get(this IGetKernel kernel, Type type)
        {
            // Binding should inject - for singletons, consts, etc.
            var binding = kernel.GetBinding(type);

            if (binding == null)
            {
                throw new InvalidOperationException("Can't Get: " + type + " no binding found");
            }
            return(binding(kernel));
        }
Beispiel #2
0
 /// <summary>
 /// Returns binding for argument
 /// </summary>
 private static Binding GetArgBinding(this IGetKernel kernel, Type type, string name)
 {
     return(kernel.GetOverrideBinding(type, name) ?? kernel.GetBinding(type));
 }
Beispiel #3
0
 public static bool CanBind(this IGetKernel kernel, Type type)
 {
     return(kernel.GetBinding(type) != null);
 }