示例#1
0
文件: Process.cs 项目: dvdrtn/OpenSlx
        /// <summary>
        /// Add a method to the definition for the entity.
        /// </summary>
        /// <param name="entity"></param>
        /// <param name="method"></param>
        private static void AddMethodToEntity(OrmEntity entity, MethodDescription method)
        {
            OrmEntityMethod targetMethod = null;

            targetMethod = method.CreateMethod(entity);
            OrmMethodTarget        targetStep = method.CreateTarget(AUTOWIRE_HEADER);
            TargetMethodCollection targetColl = null;

            switch (method.StepType)
            {
            case TargetStepType.PreExecute:
                targetColl = targetMethod.PreExecuteTargets;
                break;

            case TargetStepType.PostFlush:
                targetColl = targetMethod.PostFlushTargets;
                break;

            case TargetStepType.PostExecute:
                targetColl = targetMethod.PostExecuteTargets;
                break;

            case TargetStepType.Primary:
            default:
                targetColl = targetMethod.MethodTargets;
                break;
            }
            targetColl.Add(targetStep);
            entity.Methods.Add(targetMethod);
        }
示例#2
0
        private static bool CleanAutowireMethodsTarget(TargetStepType targetStepType, TargetMethodCollection targetColl, List<MethodDescription> methodsToCreate)
        {
            List<OrmMethodTarget> targetsToRemove = new List<OrmMethodTarget>();
            foreach (OrmMethodTarget target in targetColl)
            {
                if (IsOpenSlxTarget(target))
                {
                    MethodDescription targetMatch = methodsToCreate.FirstOrDefault(x => x.MatchTarget(target, targetStepType, AUTOWIRE_HEADER));
                    if (targetMatch != null)
                    {
                        methodsToCreate.Remove(targetMatch);
                    }
                    else
                    {
                        targetsToRemove.Add(target);
                    }
                }
            }
            foreach (OrmMethodTarget target in targetsToRemove)
            {
                targetColl.Remove(target);
            }

            return targetsToRemove.Count > 0;
        }
示例#3
0
文件: Process.cs 项目: dvdrtn/OpenSlx
        private static bool CleanAutowireMethodsTarget(TargetStepType targetStepType, TargetMethodCollection targetColl, List <MethodDescription> methodsToCreate)
        {
            List <OrmMethodTarget> targetsToRemove = new List <OrmMethodTarget>();

            foreach (OrmMethodTarget target in targetColl)
            {
                if (IsOpenSlxTarget(target))
                {
                    MethodDescription targetMatch = methodsToCreate.FirstOrDefault(x => x.MatchTarget(target, targetStepType, AUTOWIRE_HEADER));
                    if (targetMatch != null)
                    {
                        methodsToCreate.Remove(targetMatch);
                    }
                    else
                    {
                        targetsToRemove.Add(target);
                    }
                }
            }
            foreach (OrmMethodTarget target in targetsToRemove)
            {
                targetColl.Remove(target);
            }

            return(targetsToRemove.Count > 0);
        }