如何添加跟踪实体集合的方法并将其标记为开/关(以表示是否已对其执行过程)?

时间:2013-05-31 18:10:48

标签: entity-framework design-patterns partial-classes

我的第一个想法是扩展部分类'Step',它是一个实体。我可以添加一个bool属性然后设置为true / false,因为我完成了对它们的处理..但是每次我在更改DB后重新生成DBContext都不会手动继续这样做吗?或者是其他方式..下面的代码解释了我想要做的事情

    if ((si.StepID == 20) || (si.StepID == 23) || (si.StepID == 24))
                    {
                        //Step is a process. Each Step must be run in order
                        //get list of steps in tasks in RUN (1,2,3,4...) order
                        int stepToRun = 0;
                        var stepsInTask = InstanceExpert.GetAllStepsInTaskOrderedByRunOrder(ti.TaskInstanceID);

                        //Get which step is next to be processed
                        foreach (Step s in stepsInTask)
                        {
                            //get the stepToRun 
                            //Need to extend STEP Entity property with a bool??
                        }

                        //Take that step and run the specific function

                        if (stepToRun == 20)
                        {
                        }

                        if (stepToRun == 23)
                        {
                        }

                        if (stepToRun == 24)
                        {
                        }

0 个答案:

没有答案