src/Misc/EFTools/EntityDesign/UI/ViewModels/MappingDetails/MappingEFElement.cs
// <summary>
//     This lets you switch the underlyingModelItem.
// </summary>
// <param name="cpc">The transaction to use for this entire process, cannot be null</param>
// <param name="context">The current EditingContext</param>
// <param name="newUnderlyingModelItem">The new model item to switch to</param>
// <param name="deleteModelItemOnly">If 'true' then the MappingEFElement will just have its model item switched, if 'false' then a new MappingEFElement will be create and this one will be deleted</param>
This lets you switch the underlyingModelItem.
This lets you switch the underlyingModelItem .
internal void SwitchModelItem(
            CommandProcessorContext cpc, EditingContext context, EFElement newUnderlyingModelItem, bool deleteModelItemOnly)
        {
            Debug.Assert(cpc != null, "You should send a cpc to this function so that the entire switch is in a single transaction");
            var cmd = new DelegateCommand(
                () =>
                    {
                        if (deleteModelItemOnly)
                        {
                            DeleteModelItemsRecursive(this, cpc);
                            CreateModelItem(cpc, context, newUnderlyingModelItem);
                        }
                        else
                        {
                            Delete(cpc);
                            var newElement = CreateCreatorNodeCopy();
                            newElement.CreateModelItem(cpc, context, newUnderlyingModelItem);
                        }
                    });
            var cp = new CommandProcessor(cpc, cmd);
            cp.Invoke();
        }
internal void SwitchModelItem ( CommandProcessorContext cpc , EditingContext context , EFElement newUnderlyingModelItem , bool deleteModelItemOnly ) { Debug . Assert ( cpc != null , " " ) ; var cmd = new DelegateCommand ( ( ) => { if ( deleteModelItemOnly ) { DeleteModelItemsRecursive ( this , cpc ) ; CreateModelItem ( cpc , context , newUnderlyingModelItem ) ; } else { Delete ( cpc ) ; var newElement = CreateCreatorNodeCopy ( ) ; newElement . CreateModelItem ( cpc , context , newUnderlyingModelItem ) ; } } ) ; var cp = new CommandProcessor ( cpc , cmd ) ; cp . Invoke ( ) ; }
This lets you switch the underlyingModelItem.
This lets you switch the underlyingModelItem .
cpc
CommandProcessorContext
The transaction to use for this entire process, cannot be null
The transaction to use for this entire process cannot be null
context
EditingContext
The current EditingContext
The current EditingContext
newUnderlyingModelItem
EFElement
The new model item to switch to
The new model item to switch to
deleteModelItemOnly
bool
If 'true' then the MappingEFElement will just have its model item switched, if 'false' then a new MappingEFElement will be create and this one will be deleted
If ' true ' then the MappingEFElement will just have its model item switched if ' false ' then a new MappingEFElement will be create and this one will be deleted