예제 #1
0
            /// <summary>
            /// Process elements for each FactTypeHasRole definition added
            /// during deserialization. If one of our extension elements is not
            /// included in the set of extension elements then create a new one
            /// and add it.
            /// </summary>
            /// <param name="element">A Role element</param>
            /// <param name="store">The context store</param>
            /// <param name="notifyAdded">The listener to notify if elements are added during fixup</param>
            protected sealed override void ProcessElement(Role element, Store store, INotifyElementAdded notifyAdded)
            {
                IORMExtendableElement extendableElement           = element as IORMExtendableElement;
                LinkedElementCollection <ModelElement> extensions = extendableElement.ExtensionCollection;
                int extensionCount = extensions.Count;
                int i;

                for (i = 0; i < extensionCount; ++i)
                {
                    // Look for any of our extension elements
                    if (extensions[i] is MyCustomExtensionElement)
                    {
                        break;
                    }
                }
                if (i == extensionCount)
                {
                    MyCustomExtensionElement customElement = new MyCustomExtensionElement(store);
                    ExtensionElementUtility.AddExtensionElement(extendableElement, customElement);
                    // Always notify during deserialization. All rules are turned off, so
                    // any additions need to be explicitly notified so that other deserialization
                    // fixup listeners can respond appropriately.
                    notifyAdded.ElementAdded(customElement, true);
                }
            }
예제 #2
0
 public override void ElementAdded(Microsoft.VisualStudio.Modeling.ElementAddedEventArgs e)
 {
     ORMSolutions.ORMArchitect.Framework.Diagnostics.TraceUtility.TraceRuleStart(e.ModelElement.Store, "ORMSolutions.ORMArchitect.ExtensionExample.MyCustomExtensionElement.RoleAddRule");
     MyCustomExtensionElement.RoleAddRule(e);
     ORMSolutions.ORMArchitect.Framework.Diagnostics.TraceUtility.TraceRuleEnd(e.ModelElement.Store, "ORMSolutions.ORMArchitect.ExtensionExample.MyCustomExtensionElement.RoleAddRule");
 }