コード例 #1
0
ファイル: KernelEx.cs プロジェクト: AndriyMik/SimplyFast
        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));
        }
コード例 #2
0
ファイル: KernelEx.cs プロジェクト: AndriyMik/SimplyFast
 /// <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));
 }
コード例 #3
0
ファイル: KernelEx.cs プロジェクト: AndriyMik/SimplyFast
 public static bool CanBind(this IGetKernel kernel, Type type)
 {
     return(kernel.GetBinding(type) != null);
 }