Beispiel #1
0
        private static InvokeBody AddOneInvokeBody_Inner(object repository, IUnitOfWork uow, MethodBase method, int iBeginParam, params object[] args)
        {
            if (uow != null)
            {
                string methodName = method.Name;

                string postFix = "Defered";
                MethodInfo mi = null;
                ParameterInfo[] parameters = method.GetParameters();
                if (parameters != null && parameters.Length > 0)
                {
                    List<Type> paramTypes = new List<Type>();
                    for (int i = iBeginParam; i < parameters.Length; i++)
                    {
                        paramTypes.Add(parameters[i].ParameterType);
                    }
                    mi = repository.GetType().GetMethod(methodName.Substring(0, methodName.Length - postFix.Length), paramTypes.ToArray());
                }
                else
                {
                    mi = repository.GetType().GetMethod(methodName.Substring(0, methodName.Length - postFix.Length));
                }
                InvokeBody ivkBdy = new InvokeBody(repository, mi, args);
                uow.RegisterDeferMethods(ivkBdy);
                return ivkBdy;
            }
            return null;
        }
Beispiel #2
0
        public static InvokeBody AddOneInvokeBody(object repository, IUnitOfWork uow, Action actionMethod)
        {
            if (actionMethod != null && 
                uow!=null)
            {
                InvokeBody ivkBdy = new InvokeBody(repository, actionMethod);
                uow.RegisterDeferMethods(ivkBdy);
                return ivkBdy;
            }

            return null;
        }
Beispiel #3
0
 public static InvokeBody AddOneInvokeGenericBody(object repository, IUnitOfWork uow, MethodBase method, Type[] genericTypes, params object[] args)
 {
     if (uow != null)
     {
         string methodName = method.Name;
         string postFix = "Defered";
         MethodInfo mi = null;
         MethodInfo genericMethod = repository.GetType().GetMethod(methodName.Substring(0, methodName.Length - postFix.Length));
         mi = genericMethod.MakeGenericMethod(genericTypes);
         InvokeBody ivkBdy = new InvokeBody(repository, mi, args);
         uow.RegisterDeferMethods(ivkBdy);
         return ivkBdy;
     }
     return null;
 }