Esempio n. 1
0
        public static T Resolve <T>(this Je.IInjectExpander expander, Action <T> initialize)
        {
            var instance = Resolve <T>(expander);

            initialize(instance);
            return(instance);
        }
Esempio n. 2
0
        public static object Resolve(this Je.IInjectExpander expander, Type type, Action <object> initialize)
        {
            var instance = Resolve(expander, type);

            initialize(instance);
            return(instance);
        }
Esempio n. 3
0
        public static string Info(this Je.IInjectExpander expander, IMethodInvocation input, string typeName = null)
        {
            var method     = (MethodInfo)input.MethodBase;
            var parameters = method.GetParameters();
            var sb         = new StringBuilder();

            typeName = string.IsNullOrWhiteSpace(typeName) ? method.ReflectedType?.FullName : typeName;
            sb.AppendFormat("{0} {1}.{2}(", method.ReturnType, typeName, method.Name);
            for (int i = 0; i < parameters.Length; i++)
            {
                sb.AppendFormat("{0}{1} {2}", (i > 0 ? ", " : ""), parameters[i].ParameterType, parameters[i].Name);
            }
            sb.Append(")");
            return(sb.ToString());
        }
Esempio n. 4
0
        public static string InfoEx(this Je.IInjectExpander expander, IMethodInvocation input)
        {
            var method     = (MethodInfo)input.MethodBase;
            var parameters = method.GetParameters();
            var arguments  = input.Arguments;
            var sb         = new StringBuilder();

            sb.AppendFormat("{0} {1}.{2}(", method.ReturnType, method.ReflectedType?.FullName, method.Name);
            for (int i = 0; i < parameters.Length; i++)
            {
                var value = i < arguments.Count ? (arguments[i] != null ? arguments[i].ToString() : "<null>") : "<>";
                sb.AppendFormat("{0}{1} {2}: \"{3}\"", (i > 0 ? ", " : ""), parameters[i].ParameterType, parameters[i].Name, value);
            }
            sb.Append(")");
            return(sb.ToString());
        }
Esempio n. 5
0
        public static IMethodReturn Call(this Je.IInjectExpander expander, IMethodInvocation input, GetNextHandlerDelegate getNext)
        {
            var next = getNext();

            if (next == null)
            {
                return(input.CreateMethodReturn(null));
            }
            var result = next.Invoke(input, getNext);

            if (result == null)
            {
                return(input.CreateMethodReturn(null));
            }
            if (result.Exception == null)
            {
                return(result);
            }
            throw result.Exception;
        }
Esempio n. 6
0
 public static object Resolve(this Je.IInjectExpander expander, Type type)
 {
     return(Container.Resolve(type));
 }
Esempio n. 7
0
 public static T Resolve <T>(this Je.IInjectExpander expander)
 {
     return(Container.Resolve <T>());
 }
Esempio n. 8
0
 public static Type TypeOf(this Je.IInjectExpander expander, Type type)
 {
     return(Container.Resolve(type).GetType());
 }
Esempio n. 9
0
 public static Type TypeOf <T>(this Je.IInjectExpander expander)
 {
     return(Container.Resolve <T>().GetType());
 }
Esempio n. 10
0
 public static void Register(this Je.IInjectExpander expander)
 {
     Register(Container);
 }