internal override void Invoke(CommandProcessorContext cpc) { var viewModel = Inheritance.GetRootViewModel(); Debug.Assert(viewModel != null, "Unable to find root view model from inheritance: " + Inheritance); if (viewModel != null) { var derivedEntity = viewModel.ModelXRef.GetExisting(Inheritance.TargetEntityType) as ConceptualEntityType; Debug.Assert(derivedEntity != null); if (derivedEntity != null) { viewModel.ModelXRef.Remove(derivedEntity.BaseType, Inheritance); var cmd = new DeleteInheritanceCommand(derivedEntity); CommandProcessor.InvokeSingleCommand(cpc, cmd); } } }
/// <summary> /// We override this method because we need to do some extra things before /// the normal PreInvoke gets called and our antiDeps are removed /// </summary> /// <param name="cpc"></param> protected override void PreInvoke(CommandProcessorContext cpc) { // save off the deleted entity type name SaveDeletedInformation(); // enforce our mapping rules for C-side entities if (EntityType.EntityModel.IsCSDL) { EnforceEntitySetMappingRules.AddRule(cpc, EntityType); // remove base type for all derived EntityTypes var cet = EntityType as ConceptualEntityType; Debug.Assert(cet != null, "EntityType is not a ConceptualEntityType"); foreach (var derivedType in cet.ResolvableDirectDerivedTypes) { var cmd = new DeleteInheritanceCommand(derivedType); CommandProcessor.InvokeSingleCommand(cpc, cmd); } } base.PreInvoke(cpc); }