protected override void InvokeInternal(CommandProcessorContext cpc) { // safety check, this should never be hit Debug.Assert(Property != null, "InvokeInternal is called when Property is null."); if (Property == null) { throw new InvalidOperationException("InvokeInternal is called when Property is null."); } var cmd = new UpdateDefaultableValueCommand <string>(Property.StoreGeneratedPattern, SgpValue); CommandProcessor.InvokeSingleCommand(cpc, cmd); // ensure view keys are propagated from C-side to S-side var cet = Property.EntityType as ConceptualEntityType; if (cet != null) { PropagateViewKeysToStorageModel.AddRule(cpc, cet); } // ensure StoreGeneratedPattern is propagated from C-side to S-side // unless we are part of an Update Model txn in which case there is no need // as the whole artifact has this integrity check applied by UpdateModelFromDatabaseCommand if (EfiTransactionOriginator.UpdateModelFromDatabaseId != cpc.OriginatorId) { var cProp = Property as ConceptualProperty; Debug.Assert(cProp != null, "expected Property of type ConceptualProperty, instead got type " + Property.GetType().FullName); if (cProp != null) { PropagateStoreGeneratedPatternToStorageModel.AddRule(cpc, cProp, true); } } }
protected override void InvokeInternal(CommandProcessorContext cpc) { var cmd = new UpdateDefaultableValueCommand <string>(_typeAccess, _newValue); CommandProcessor.InvokeSingleCommand(cpc, cmd); if (ModelConstants.CodeGenerationAccessInternal.Equals(_newValue, StringComparison.Ordinal)) { var cet = _typeAccess.GetParentOfType(typeof(ConceptualEntityType)) as ConceptualEntityType; Debug.Assert(null != cet, "parent of _typeAccess should be of type " + typeof(ConceptualEntityType).FullName); if (null != cet) { // Note: it is valid for the EntitySet to be null var ces = cet.EntitySet as ConceptualEntitySet; if (null != ces) { var entitySetGetterAccess = ces.GetterAccess.Value; if (ModelConstants.CodeGenerationAccessPublic.Equals(entitySetGetterAccess) || ModelConstants.CodeGenerationAccessProtected.Equals(entitySetGetterAccess)) { // new value is Internal and EntitySet's existing value is Public or Protected // so need to also update the GetterAccess attribute on the EntitySet // (otherwise will get runtime error 6036) var cmd2 = new UpdateDefaultableValueCommand <string>(ces.GetterAccess, _newValue); CommandProcessor.InvokeSingleCommand(cpc, cmd2); } } } } }
protected override void InvokeInternal(CommandProcessorContext cpc) { // if the DesignerInfoPropertySet doesn't exist then we need to create it. if (_designerInfo.PropertySet == null) { _designerInfo.PropertySet = new DesignerInfoPropertySet(_designerInfo, null); } // if the DesignerProperty doesn't exist then we need to create it. DesignerProperty designerProperty; if (!_designerInfo.PropertySet.TryGetDesignerProperty(_name, out designerProperty)) { designerProperty = new DesignerProperty(_designerInfo.PropertySet, null); designerProperty.LocalName.Value = _name; _designerInfo.PropertySet.AddDesignerProperty(_name, designerProperty); } // First let's check make sure any non-valid values are caught up the stack if (!designerProperty.ValueAttr.IsValidValue(_value)) { throw new CommandValidationFailedException( String.Format(CultureInfo.CurrentCulture, Resources.NonValidDesignerProperty, _value, _name)); } // now we update the value of the designer property var cmdUpdateDefaultableValue = new UpdateDefaultableValueCommand <string>(designerProperty.ValueAttr, _value); CommandProcessor.InvokeSingleCommand(cpc, cmdUpdateDefaultableValue); // normalize and resolve the entire DesignerInfo XmlModelHelper.NormalizeAndResolve(_designerInfo); }
/// <summary> /// Update function import IsComposable attribute if changed. /// </summary> private void UpdateFunctionImportIsComposable(CommandProcessorContext cpc) { var previousValue = FunctionImport.IsComposable.Value; if (FunctionImportIsComposable != previousValue) { Command updateComposableCommand = new UpdateDefaultableValueCommand <BoolOrNone>( FunctionImport.IsComposable, FunctionImportIsComposable); CommandProcessor.InvokeSingleCommand(cpc, updateComposableCommand); } }