/// <summary>
        /// Updates child action's status to the data store.
        /// </summary>
        /// <param name="action"></param>
        protected override void UpdateChildAction(MigrationAction action)
        {
            using (RuntimeEntityModel context = RuntimeEntityModel.CreateInstance())
            {
                var changeActionQuery = context.RTChangeActionSet.Where
                                            (ca => ca.ChangeActionId == action.ActionId);
                int changeActionQueryCount = changeActionQuery.Count();
                if (changeActionQueryCount == 0)
                {
                    return;
                }

                Debug.Assert(changeActionQueryCount == 1);
                RTChangeAction rtChangeAction = changeActionQuery.First();

                bool needToUpdateRTChangeAction = false;

                if (action.State == ActionState.Skipped)
                {
                    rtChangeAction.IsSubstituted = true;
                    needToUpdateRTChangeAction   = true;
                }
                if (rtChangeAction.ActionId != action.Action)
                {
                    rtChangeAction.ActionId    = action.Action;
                    needToUpdateRTChangeAction = true;
                }

                if (needToUpdateRTChangeAction)
                {
                    context.TrySaveChanges();
                }
            }
        }
Beispiel #2
0
        public static MigrationConflict CreateConflict(
            MigrationAction conflictAction,
            string message)
        {
            VCInvalidLabelNameConflictType conflictInstance = new VCInvalidLabelNameConflictType();

            return(new VCInvalidLabelNameConflict(conflictInstance, conflictAction, message));
        }
        public static MigrationConflict CreateConflict(
            MigrationAction conflictAction,
            string message)
        {
            VCLabelAlreadyExistsConflictType conflictInstance = new VCLabelAlreadyExistsConflictType();

            return(new VCLabelAlreadyExistsConflict(conflictInstance, conflictAction, message));
        }
        public static MigrationConflict CreateConflict(
            MigrationAction conflictAction)
        {
            if (conflictAction == null)
            {
                throw new ArgumentNullException("conflictAction");
            }
            VCNameSpaceContentConflictType conflictInstance = new VCNameSpaceContentConflictType();

            return(new VCNameSpaceContentConflict(conflictInstance, conflictAction));
        }
Beispiel #5
0
        /// <summary>
        /// Saves the child change action of this group
        /// </summary>
        /// <param name="action"></param>
        public virtual void Save(MigrationAction action)
        {
            Debug.Assert(action.ChangeGroup == this,
                         "Saving change action failed. The change action does not belong to this change group.");
            Debug.Assert(m_changeGroupId != long.MinValue,
                         "Saving change action failed. The change group has not been persisted to DB yet.");
            Debug.Assert(action.ActionId > 0,
                         "Saving change action failed. The change action has not been persisted to DB yet.");

            UpdateChildAction(action);
        }
Beispiel #6
0
        private void BeforeCopyDeltaTableEntryToMigrationInstructionTable(
            MigrationAction migrationAction,
            Guid sourceIdOfDeltaTableOwner)
        {
            if (null == m_translationService)
            {
                return;
            }

            m_translationService.Translate(migrationAction, sourceIdOfDeltaTableOwner);
        }
        public static MigrationConflict CreateConflict(
            MigrationAction conflictAction,
            string message,
            string path)
        {
            if (path == null)
            {
                throw new ArgumentNullException("path");
            }
            VCInvalidPathConflictType conflictInstance = new VCInvalidPathConflictType();

            return(new VCInvalidPathConflict(conflictInstance, conflictAction, message, path));
        }
        public override void Translate(IMigrationAction action, Guid migrationSourceIdOfChangeGroup)
        {
            MigrationAction migrAction = action as MigrationAction;

            Debug.Assert(migrAction != null, "action is not a MigrationActin");

            migrAction.Path     = GetMappedPath(action.Path, migrationSourceIdOfChangeGroup);
            migrAction.FromPath = GetMappedPath(action.FromPath, migrationSourceIdOfChangeGroup);

            if (UserIdLookupService.IsConfigured)
            {
                if (action.ChangeGroup.ChangeGroupId != m_cachedUserIdLookupResult.Key)
                {
                    IdentityLookupContext context = new IdentityLookupContext(
                        migrationSourceIdOfChangeGroup, m_migratinSourcePair[migrationSourceIdOfChangeGroup]);

                    UserIdPropertyNameEnum srcDefaultUserIdProperty;
                    UserIdPropertyNameEnum targetDefaultUserIdProperty;
                    if (UserIdLookupService.TryGetDefaultUserIdProperty(context.SourceMigrationSourceId, out srcDefaultUserIdProperty) &&
                        UserIdLookupService.TryGetDefaultUserIdProperty(context.TargetMigrationSourceId, out targetDefaultUserIdProperty))
                    {
                        RichIdentity srcUserId = new RichIdentity();
                        srcUserId[srcDefaultUserIdProperty.ToString()] = action.ChangeGroup.Owner; // todo: parse qualified name?

                        RichIdentity mappedUserId;
                        if (UserIdLookupService.TryLookup(srcUserId, context, out mappedUserId))
                        {
                            action.ChangeGroup.Owner = mappedUserId[targetDefaultUserIdProperty.ToString()];
                        }
                    }

                    m_cachedUserIdLookupResult = new KeyValuePair <long, string>(action.ChangeGroup.ChangeGroupId, action.ChangeGroup.Owner);
                }
                else
                {
                    action.ChangeGroup.Owner = m_cachedUserIdLookupResult.Value;
                }
            }
        }
Beispiel #9
0
 /// <summary>
 /// Updates the child change action of this group in the data store.
 /// </summary>
 /// <param name="childAction"></param>
 protected abstract void UpdateChildAction(MigrationAction childAction);