src/Misc/EFTools/EntityDesign/VisualStudio/Package/ModelChangeEventListener.cs
// <summary>
//     Event handler when we change any properties of the model. For now we'll handle just the renaming
//     the entity container name.
// </summary>
Event handler when we change any properties of the model. For now we'll handle just the renaming
the entity container name.
Event handler when we change any properties of the model . For now we ' ll handle just the renaming the entity container name .
private void OnModelChangesCommitted(object sender, EfiChangedEventArgs e)
        {
            var changeEnum = e.ChangeGroup.Changes.GetEnumerator();
            while (changeEnum.MoveNext())
            {
                if (changeEnum.Current.Type == EfiChange.EfiChangeType.Update)
                {
                    var entityContainer = changeEnum.Current.Changed as SingleItemBinding<ConceptualEntityContainer>;
                    if (entityContainer != null)
                    {
                        var pair = changeEnum.Current.Properties[EntityContainerMapping.AttributeCdmEntityContainer];
                        var args = new ModelChangeEventArgs();
                        args.OldEntityContainerName = (string)pair.OldValue;
                        AfterEntityContainerNameChange(this, args);
                        continue;
                    }
                }
                var metadataArtifactProcessingValue = changeEnum.Current.Changed as DefaultableValue<string>;
                if (metadataArtifactProcessingValue != null)
                {
                    var mapProp = metadataArtifactProcessingValue.Parent as DesignerProperty;
                    if (mapProp != null
                        && mapProp.LocalName != null
                        && String.Compare(
                            mapProp.LocalName.Value, ConnectionDesignerInfo.AttributeMetadataArtifactProcessing,
                            StringComparison.OrdinalIgnoreCase) == 0)
                    {
                        var pair = changeEnum.Current.Properties[DesignerProperty.AttributeValue];
                        var args = new ModelChangeEventArgs();
                        args.OldMetadataArtifactProcessing = (string)pair.OldValue;
                        AfterMetadataArtifactProcessingChange(this, args);
                        continue;
                    }
                }
            }
        }
private void OnModelChangesCommitted ( object sender , EfiChangedEventArgs e ) { var changeEnum = e . ChangeGroup . Changes . GetEnumerator ( ) ; while ( changeEnum . MoveNext ( ) ) { if ( changeEnum . Current . Type == EfiChange . EfiChangeType . Update ) { var entityContainer = changeEnum . Current . Changed as SingleItemBinding < ConceptualEntityContainer > ; if ( entityContainer != null ) { var pair = changeEnum . Current . Properties [ EntityContainerMapping . AttributeCdmEntityContainer ] ; var args = new ModelChangeEventArgs ( ) ; args . OldEntityContainerName = ( string ) pair . OldValue ; AfterEntityContainerNameChange ( this , args ) ; continue ; } } var metadataArtifactProcessingValue = changeEnum . Current . Changed as DefaultableValue < string > ; if ( metadataArtifactProcessingValue != null ) { var mapProp = metadataArtifactProcessingValue . Parent as DesignerProperty ; if ( mapProp != null && mapProp . LocalName != null && String . Compare ( mapProp . LocalName . Value , ConnectionDesignerInfo . AttributeMetadataArtifactProcessing , StringComparison . OrdinalIgnoreCase ) == 0 ) { var pair = changeEnum . Current . Properties [ DesignerProperty . AttributeValue ] ; var args = new ModelChangeEventArgs ( ) ; args . OldMetadataArtifactProcessing = ( string ) pair . OldValue ; AfterMetadataArtifactProcessingChange ( this , args ) ; continue ; } } } }
Event handler when we change any properties of the model.
Event handler when we change any properties of the model .
// update operation? // are we updating the entity container name? // get the values from the EfiChange properties, use those to construct the arguments // ignore any further action // are we updating the metadata artifact processing value?
sender
object
e
EfiChangedEventArgs