예제 #1
0
        private void ExicuteNextChain(PatchTypeEnum type, DataAccessor <DMSource> accessor, Type connectionType,
                                      DMSource model, IDataModel connectionModel)
        {
            switch (type.EnumValue)
            {
            case PatchTypeEnum.Enum.Create:
            {
                Type managerType = RC.GetManagerType(connectionType);
                var  method      = GetMethod(managerType, connectionType);
                method.Invoke(RC.GetManager(connectionType), new object[] { CommitTypeEnum.ADD, connectionModel, 0 });
                accessor.CreateConnection(model, accessor.DATA_MAP.Connection(connectionType), connectionModel.ID);
                break;
            }

            case PatchTypeEnum.Enum.Update:
            {
                Type managerType = RC.GetManagerType(connectionType);
                var  method      = GetMethod(managerType, connectionType);
                method.Invoke(RC.GetManager(connectionType), new object[] { CommitTypeEnum.UPDATE, connectionModel, connectionModel.ID });
                accessor.UpdateConnection(model, accessor.DATA_MAP.Connection(connectionType), connectionModel.ID);
                break;
            }

            case PatchTypeEnum.Enum.Delete:
            {
                Type managerType = RC.GetManagerType(connectionType);
                var  method      = GetMethod(managerType, connectionType);
                method.Invoke(RC.GetManager(connectionType), new object[] { CommitTypeEnum.REMOVE, connectionModel, connectionModel.ID });
                accessor.DeleteConnection(model.GetConnectionID(connectionType, connectionModel.ID));
                break;
            }

            default:
                break;
            }
        }