src/Misc/EFTools/EntityDesignEntityDesigner/CustomCode/Diagram/EntityDesignerDiagram.cs
/// <summary>
///     Asks the user if they would like to also delete any
///     storage EntitySets which will be unmapped. If the answer
///     is Yes, also has the side-effect of adding the list of
///     unmapped sets to DeleteUnmappedStorageEntitySetsProperty
///     in the view-model's Store PropertyBag
/// </summary>
/// <param name="selectedModelElements">C-side objects to be deleted</param>
/// <returns>
///     Result of asking the user, or No if never asked;
///     possible results are Yes, No, or Cancel (No means just delete the  C-side
///     objects, Yes means also delete the S-side objects that will become unmapped,
///     Cancel means don't delete anything
/// </returns>
Asks the user if they would like to also delete any
storage EntitySets which will be unmapped. If the answer
is Yes, also has the side-effect of adding the list of
unmapped sets to DeleteUnmappedStorageEntitySetsProperty
in the view-model's Store PropertyBag
Asks the user if they would like to also delete any storage EntitySets which will be unmapped . If the answer is Yes also has the side - effect of adding the list of unmapped sets to DeleteUnmappedStorageEntitySetsProperty in the view - model ' s Store PropertyBag
internal DialogResult ShouldDeleteUnmappedStorageEntitySets(List<EFElement> selectedModelElements)
        {
            if (null == selectedModelElements
                || 0 >= selectedModelElements.Count)
            {
                return DialogResult.No;
            }
            var unmappedStorageEntitySets =
                DeleteUnmappedStorageEntitySetsCommand.UnmappedStorageEntitySetsIfDelete(selectedModelElements);
            if (0 >= unmappedStorageEntitySets.Count)
            {
                return DialogResult.No;
            }
            using (var dialog =
                new DeleteStorageEntitySetsDialog(unmappedStorageEntitySets))
            {
                var result = dialog.ShowDialog();
                if (DialogResult.Yes == result)
                {
                    var viewModel = GetModel();
                    Debug.Assert(null != viewModel, "viewModel should not be null");
                    if (null != viewModel)
                    {
                        List<ICollection<StorageEntitySet>> unmappedMasterList = null;
                        if (viewModel.Store.PropertyBag.ContainsKey(EntityDesignerViewModel.DeleteUnmappedStorageEntitySetsProperty))
                        {
                            unmappedMasterList =
                                viewModel.Store.PropertyBag[EntityDesignerViewModel.DeleteUnmappedStorageEntitySetsProperty] as
                                List<ICollection<StorageEntitySet>>;
                        }
                        if (unmappedMasterList == null)
                        {
                            unmappedMasterList = new List<ICollection<StorageEntitySet>>();
                            viewModel.Store.PropertyBag[EntityDesignerViewModel.DeleteUnmappedStorageEntitySetsProperty] =
                                unmappedMasterList;
                        }
                        unmappedMasterList.Add(unmappedStorageEntitySets);
                    }
                }
                return result;
            }
        }
internal DialogResult ShouldDeleteUnmappedStorageEntitySets ( List < EFElement > selectedModelElements ) { if ( null == selectedModelElements || 0 >= selectedModelElements . Count ) { return DialogResult . No ; } var unmappedStorageEntitySets = DeleteUnmappedStorageEntitySetsCommand . UnmappedStorageEntitySetsIfDelete ( selectedModelElements ) ; if ( 0 >= unmappedStorageEntitySets . Count ) { return DialogResult . No ; } using ( var dialog = new DeleteStorageEntitySetsDialog ( unmappedStorageEntitySets ) ) { var result = dialog . ShowDialog ( ) ; if ( DialogResult . Yes == result ) { var viewModel = GetModel ( ) ; Debug . Assert ( null != viewModel , " " ) ; if ( null != viewModel ) { List < ICollection < StorageEntitySet > > unmappedMasterList = null ; if ( viewModel . Store . PropertyBag . ContainsKey ( EntityDesignerViewModel . DeleteUnmappedStorageEntitySetsProperty ) ) { unmappedMasterList = viewModel . Store . PropertyBag [ EntityDesignerViewModel . DeleteUnmappedStorageEntitySetsProperty ] as List < ICollection < StorageEntitySet > > ; } if ( unmappedMasterList == null ) { unmappedMasterList = new List < ICollection < StorageEntitySet > > ( ) ; viewModel . Store . PropertyBag [ EntityDesignerViewModel . DeleteUnmappedStorageEntitySetsProperty ] = unmappedMasterList ; } unmappedMasterList . Add ( unmappedStorageEntitySets ) ; } } return result ; } }
Asks the user if they would like to also delete any
storage EntitySets which will be unmapped.
Asks the user if they would like to also delete any storage EntitySets which will be unmapped .
// if there are no selected elements then return 'No' // find which S-side EntitySets would be deleted // only offer user choice if there are any S-side EntitySets to delete // show dialog giving user the choice to (a) delete only the  // C-side objects selected, (b) to also delete any StorageEntitySets // which will end up unmapped, or (c) cancel the whole operation // user decided to also delete the unmapped StorageEntitySets; // the property below is checked in the EntityDesignerViewModel when committing the changes
Result of asking the user, or No if never asked;
possible results are Yes, No, or Cancel (No means just delete the  C-side
objects, Yes means also delete the S-side objects that will become unmapped,
Cancel means don't delete anything
Result of asking the user or No if never asked ; possible results are Yes No or Cancel ( No means just delete the C - side objects Yes means also delete the S - side objects that will become unmapped Cancel means don ' t delete anything
selectedModelElements
List<EFElement>
C-side objects to be deleted
C - side objects to be deleted