예제 #1
0
 /// <summary>
 ///    Called after the IsDatabaseSchemaTracking property changes.
 /// </summary>
 /// <param name="element">The model element that has the property that changed. </param>
 /// <param name="oldValue">The previous value of the property. </param>
 /// <param name="newValue">The new value of the property. </param>
 protected override void OnValueChanged(ModelClass element, bool oldValue, bool newValue)
 {
     base.OnValueChanged(element, oldValue, newValue);
     if (!element.Store.InUndoRedoOrRollback && newValue)
     {
         DomainPropertyInfo propInfo = element.Store.DomainDataDirectory.GetDomainProperty(DatabaseSchemaDomainPropertyId);
         propInfo.NotifyValueChange(element);
     }
 }
예제 #2
0
 /// <summary>
 ///    Called after the IsTargetImplementNotifyTracking property changes.
 /// </summary>
 /// <param name="element">The model element that has the property that changed. </param>
 /// <param name="oldValue">The previous value of the property. </param>
 /// <param name="newValue">The new value of the property. </param>
 protected override void OnValueChanged(Association element, bool oldValue, bool newValue)
 {
     base.OnValueChanged(element, oldValue, newValue);
     if (!element.Store.InUndoRedoOrRollback && newValue)
     {
         DomainPropertyInfo propInfo = element.Store.DomainDataDirectory.GetDomainProperty(TargetImplementNotifyDomainPropertyId);
         propInfo.NotifyValueChange(element);
     }
 }
예제 #3
0
 /// <summary>
 /// Called after the IsDisplayNameTracking property changes.
 /// </summary>
 protected override void OnValueChanged(NamedElementSchema element, bool oldValue, bool newValue)
 {
     base.OnValueChanged(element, oldValue, newValue);
     if (!element.Store.InUndoRedoOrRollback && newValue)
     {
         DomainPropertyInfo propInfo =
             element.Store.DomainDataDirectory.GetDomainProperty(
                 NamedElementSchema.DisplayNameDomainPropertyId);
         propInfo.NotifyValueChange(element);
     }
 }
        public DomainEnumPropertyDescriptor(ElementTypeDescriptor owner, ModelElement modelElement, DomainPropertyInfo domainProperty, DomainEnumeration domainEnum, Attribute[] attributes)
            : base(owner, modelElement, domainProperty, attributes)
        {
            this.domainEnum = domainEnum;

            System.Collections.Generic.List<string> list = new System.Collections.Generic.List<string>();
            foreach(EnumerationLiteral enumerationLiteral in this.domainEnum.Literals)
                list.Add(enumerationLiteral.Name);
            
            enumFields = list.AsReadOnly();
        }
예제 #5
0
        /// <summary>
        /// Manages <see cref="EventHandler{TEventArgs}"/>s in the <see cref="Store"/> for <see cref="ORMBaseShape"/>s.
        /// </summary>
        /// <param name="store">The <see cref="Store"/> for which the <see cref="EventHandler{TEventArgs}"/>s should be managed.</param>
        /// <param name="eventManager">The <see cref="ModelingEventManager"/> used to manage the <see cref="EventHandler{TEventArgs}"/>s.</param>
        /// <param name="action">The <see cref="EventHandlerAction"/> that should be taken for the <see cref="EventHandler{TEventArgs}"/>s.</param>
        public static void ManageEventHandlers(Store store, ModelingEventManager eventManager, EventHandlerAction action)
        {
            DomainDataDirectory dataDirectory = store.DomainDataDirectory;
            DomainClassInfo     classInfo     = dataDirectory.FindDomainClass(ORMBaseShape.DomainClassId);
            DomainPropertyInfo  propertyInfo  = dataDirectory.FindDomainProperty(UpdateCounterDomainPropertyId);

            eventManager.AddOrRemoveHandler(propertyInfo, new EventHandler <ElementPropertyChangedEventArgs>(UpdateRequiredEvent), action);
            eventManager.AddOrRemoveHandler(classInfo, new EventHandler <ElementAddedEventArgs>(ShapeAddedEvent), action);
            classInfo = dataDirectory.FindDomainClass(PresentationViewsSubject.DomainClassId);
            eventManager.AddOrRemoveHandler(classInfo, new EventHandler <ElementDeletedEventArgs>(ShapeDeletedEvent), action);
        }
예제 #6
0
 private static void PropagateChange(NameGenerator parentGenerator, DomainPropertyInfo propertyInfo, object oldValue, object newValue)
 {
     foreach (NameGenerator refinement in parentGenerator.RefinedByGeneratorCollection)
     {
         if (propertyInfo.GetValue(refinement).Equals(oldValue))
         {
             propertyInfo.SetValue(refinement, newValue);
             PropagateChange(refinement, propertyInfo, oldValue, newValue);
         }
     }
 }
예제 #7
0
        /// <summary>
        /// Unsubscribes from a specific event.
        /// </summary>
        /// <param name="domainClassInfo">Domain class info specifying when to unsubscribe.</param>
        /// <param name="domainPropertyInfo">Domain property info specifying when to unsubscribe.</param>
        /// <param name="action">Action identifying what to unsubscribe.</param>
        public void Unsubscribe(DomainClassInfo domainClassInfo, DomainPropertyInfo domainPropertyInfo, Action <ElementPropertyChangedEventArgs> action)
        {
            lock (dictionaryOnClassInfoPropertyInfo)
            {
                Guid domainClassId    = domainClassInfo.Id;
                Guid domainPropertyId = domainPropertyInfo.Id;

                if (dictionaryOnClassInfoPropertyInfo.Keys.Contains(domainClassId))
                {
                    if (dictionaryOnClassInfoPropertyInfo[domainClassId].Keys.Contains(domainPropertyId))
                    {
                        IEventSubscription eventSubscription = dictionaryOnClassInfoPropertyInfo[domainClassId][domainPropertyId].Cast <EventSubscription <ElementPropertyChangedEventArgs> >().FirstOrDefault(evt => evt.Action == action);
                        if (eventSubscription != null)
                        {
                            dictionaryOnClassInfoPropertyInfo[domainClassId][domainPropertyId].Remove(eventSubscription);
                            if (dictionaryOnClassInfoPropertyInfo[domainClassId][domainPropertyId].Count == 0)
                            {
                                dictionaryOnClassInfoPropertyInfo[domainClassId].Remove(domainPropertyId);
                            }
                            if (dictionaryOnClassInfoPropertyInfo[domainClassId].Count == 0)
                            {
                                dictionaryOnClassInfoPropertyInfo.Remove(domainClassId);
                            }
                        }
                    }
                }

                // continue with descendants
                foreach (DomainClassInfo info in domainClassInfo.AllDescendants)
                {
                    domainClassId = info.Id;
                    if (dictionaryOnClassInfoPropertyInfo.Keys.Contains(domainClassId))
                    {
                        if (dictionaryOnClassInfoPropertyInfo[domainClassId].Keys.Contains(domainPropertyId))
                        {
                            IEventSubscription eventSubscription = dictionaryOnClassInfoPropertyInfo[domainClassId][domainPropertyId].Cast <EventSubscription <ElementPropertyChangedEventArgs> >().FirstOrDefault(evt => evt.Action == action);
                            if (eventSubscription != null)
                            {
                                dictionaryOnClassInfoPropertyInfo[domainClassId][domainPropertyId].Remove(eventSubscription);
                                if (dictionaryOnClassInfoPropertyInfo[domainClassId][domainPropertyId].Count == 0)
                                {
                                    dictionaryOnClassInfoPropertyInfo[domainClassId].Remove(domainPropertyId);
                                }
                                if (dictionaryOnClassInfoPropertyInfo[domainClassId].Count == 0)
                                {
                                    dictionaryOnClassInfoPropertyInfo.Remove(domainClassId);
                                }
                            }
                        }
                    }
                }
            }
        }
        /// <summary>
        ///    Returns the property descriptors for the described ModelClass domain class, adding tracking property
        ///    descriptor(s).
        /// </summary>
        private PropertyDescriptorCollection GetCustomProperties(Attribute[] attributes)
        {
            // Get the default property descriptors from the base class
            PropertyDescriptorCollection propertyDescriptors = base.GetProperties(attributes);

            //Add the descriptor for the tracking property.
            if (ModelElement is Association association)
            {
                storeDomainDataDirectory = association.Store.DomainDataDirectory;

                // only display roles for 1..1 and 0-1..0-1 associations
                if (((association.SourceMultiplicity != Multiplicity.One || association.TargetMultiplicity != Multiplicity.One) &&
                     (association.SourceMultiplicity != Multiplicity.ZeroOne || association.TargetMultiplicity != Multiplicity.ZeroOne)))
                {
                    PropertyDescriptor sourceRoleTypeDescriptor = propertyDescriptors.OfType <PropertyDescriptor>().Single(x => x.Name == "SourceRole");
                    propertyDescriptors.Remove(sourceRoleTypeDescriptor);

                    PropertyDescriptor targetRoleTypeDescriptor = propertyDescriptors.OfType <PropertyDescriptor>().Single(x => x.Name == "TargetRole");
                    propertyDescriptors.Remove(targetRoleTypeDescriptor);
                }

                // only display delete behavior on the principal end
                if (association.SourceRole != EndpointRole.Principal)
                {
                    PropertyDescriptor sourceDeleteActionTypeDescriptor = propertyDescriptors.OfType <PropertyDescriptor>().Single(x => x.Name == "SourceDeleteAction");
                    propertyDescriptors.Remove(sourceDeleteActionTypeDescriptor);
                }

                if (association.TargetRole != EndpointRole.Principal)
                {
                    PropertyDescriptor targetDeleteActionTypeDescriptor = propertyDescriptors.OfType <PropertyDescriptor>().Single(x => x.Name == "TargetDeleteAction");
                    propertyDescriptors.Remove(targetDeleteActionTypeDescriptor);
                }

                /********************************************************************************/

                DomainPropertyInfo collectionClassPropertyInfo           = storeDomainDataDirectory.GetDomainProperty(Association.CollectionClassDomainPropertyId);
                DomainPropertyInfo isCollectionClassTrackingPropertyInfo = storeDomainDataDirectory.GetDomainProperty(Association.IsCollectionClassTrackingDomainPropertyId);

                // Define attributes for the tracking property/properties so that the Properties window displays them correctly.
                Attribute[] collectionClassAttributes =
                {
                    new DisplayNameAttribute("Collection Class"),
                    new DescriptionAttribute("Type of collections generated. Overrides the default collection class for the model"),
                    new CategoryAttribute("Code Generation")
                };

                propertyDescriptors.Add(new TrackingPropertyDescriptor(association, collectionClassPropertyInfo, isCollectionClassTrackingPropertyInfo, collectionClassAttributes));
            }

            // Return the property descriptors for this element
            return(propertyDescriptors);
        }
예제 #9
0
 public static void NotifyChangesToDesigner(this ModelElement modelElement, PropertyChangedEventArgs args)
 {
     if (!modelElement.IsDeleting && !modelElement.IsDeleted && (!modelElement.Store.InSerializationTransaction))
     {
         using (Transaction transaction = modelElement.Store.TransactionManager.BeginTransaction("Notify changes"))
         {
             DomainClassInfo    domainClassInfo = modelElement.GetDomainClass();
             DomainPropertyInfo domainProperty  = domainClassInfo.FindDomainProperty(args.PropertyName, true);
             domainProperty.NotifyValueChange(modelElement);
             transaction.Commit();
         }
     }
 }
예제 #10
0
 void IModelingEventSubscriber.ManageModelingEventHandlers(ModelingEventManager eventManager, EventSubscriberReasons reasons, EventHandlerAction action)
 {
     if (0 != (reasons & EventSubscriberReasons.SurveyQuestionEvents))
     {
         Store store = Store;
         DomainDataDirectory dataDirectory = store.DomainDataDirectory;
         DomainClassInfo     classInfo     = dataDirectory.FindDomainClass(Diagram.DomainClassId);
         eventManager.AddOrRemoveHandler(classInfo, new EventHandler <ElementAddedEventArgs>(DiagramAddedEvent), action);
         eventManager.AddOrRemoveHandler(classInfo, new EventHandler <ElementDeletedEventArgs>(DiagramRemovedEvent), action);
         DomainPropertyInfo propertyInfo = dataDirectory.FindDomainProperty(Diagram.NameDomainPropertyId);
         eventManager.AddOrRemoveHandler(propertyInfo, new EventHandler <ElementPropertyChangedEventArgs>(DiagramRenamedEvent), action);
     }
 }
예제 #11
0
        /// <summary>
        /// Create a property descriptor for the given property on
        /// the element to emulate the behavior of modifying this
        /// property in the properties window. This will succeed if the property
        /// passed in has a corresponding meta attribute.
        /// </summary>
        /// <param name="element">The element to create a descriptor for</param>
        /// <param name="propertyName">The name of the property on the native object.
        /// Note that the name of this property may be displayed differently in the
        /// properties window. For example, Role.RolePlayerDisplay is shown as RolePlayer
        /// in the properties window.</param>
        /// <returns>PropertyDescriptor, or null if not available</returns>
        public PropertyDescriptor CreatePropertyDescriptor(ModelElement element, string propertyName)
        {
            Type         elementType = element.GetType();
            PropertyInfo propInfo    = elementType.GetProperty(propertyName);

            if (propInfo != null)
            {
                DomainPropertyInfo attrInfo = element.Store.DomainDataDirectory.FindDomainClass(propInfo.DeclaringType).FindDomainProperty(propertyName, true);
                if (attrInfo != null)
                {
                    return(DomainTypeDescriptor.CreatePropertyDescriptor(element, attrInfo));
                }
            }
            return(null);
        }
        /// <summary>
        ///    Returns the property descriptors for the described ModelEnum domain class, adding tracking property
        ///    descriptor(s).
        /// </summary>
        private PropertyDescriptorCollection GetCustomProperties(Attribute[] attributes)
        {
            // Get a reference to the model element that is being described.
            ModelEnum modelEnum = ModelElement as ModelEnum;

            // Get the default property descriptors from the base class
            PropertyDescriptorCollection propertyDescriptors = base.GetProperties(attributes);

            //Add the descriptor for the tracking property.
            if (modelEnum != null)
            {
                storeDomainDataDirectory = modelEnum.Store.DomainDataDirectory;

                /********************************************************************************/

                DomainPropertyInfo namespacePropertyInfo           = storeDomainDataDirectory.GetDomainProperty(ModelEnum.NamespaceDomainPropertyId);
                DomainPropertyInfo isNamespaceTrackingPropertyInfo = storeDomainDataDirectory.GetDomainProperty(ModelEnum.IsNamespaceTrackingDomainPropertyId);

                // Define attributes for the tracking property/properties so that the Properties window displays them correctly.
                Attribute[] namespaceAttributes =
                {
                    new DisplayNameAttribute("Namespace"),
                    new DescriptionAttribute("Overrides default namespace"),
                    new CategoryAttribute("Code Generation")
                };

                propertyDescriptors.Add(new TrackingPropertyDescriptor(modelEnum, namespacePropertyInfo, isNamespaceTrackingPropertyInfo, namespaceAttributes));

                /********************************************************************************/

                DomainPropertyInfo outputDirectoryPropertyInfo           = storeDomainDataDirectory.GetDomainProperty(ModelEnum.OutputDirectoryDomainPropertyId);
                DomainPropertyInfo isOutputDirectoryTrackingPropertyInfo = storeDomainDataDirectory.GetDomainProperty(ModelEnum.IsOutputDirectoryTrackingDomainPropertyId);

                // Define attributes for the tracking property/properties so that the Properties window displays them correctly.
                Attribute[] outputDirectoryAttributes =
                {
                    new DisplayNameAttribute("Output Directory"),
                    new DescriptionAttribute("Overrides default output directory"),
                    new CategoryAttribute("Code Generation"),
                    new TypeConverterAttribute(typeof(ProjectDirectoryTypeConverter))
                };

                propertyDescriptors.Add(new TrackingPropertyDescriptor(modelEnum, outputDirectoryPropertyInfo, isOutputDirectoryTrackingPropertyInfo, outputDirectoryAttributes));
            }

            // Return the property descriptors for this element
            return(propertyDescriptors);
        }
예제 #13
0
        /// <summary>
        /// Subscribes to the property changed event. Observers are notified, whenever a property of a specific type
        /// changes.
        /// </summary>
        /// <param name="domainPropertyInfo">Property info specifying a property type, which changes cause a notification.</param>
        /// <param name="action">Action to call on the observer.</param>
        public void Subscribe(DomainPropertyInfo domainPropertyInfo, Action <ElementPropertyChangedEventArgs> action)
        {
            IDelegateReference actionReference = new DelegateReference(action, false);
            IDelegateReference filterReference = new DelegateReference(new Predicate <ElementPropertyChangedEventArgs>(delegate { return(true); }), true);
            IEventSubscription subscription    = new EventSubscription <ElementPropertyChangedEventArgs>(actionReference, filterReference);

            lock (dictionaryOnPropertyInfo)
            {
                if (!dictionaryOnPropertyInfo.Keys.Contains(domainPropertyInfo.Id))
                {
                    dictionaryOnPropertyInfo.Add(domainPropertyInfo.Id, new List <IEventSubscription>());
                }

                dictionaryOnPropertyInfo[domainPropertyInfo.Id].Add(subscription);
            }
        }
예제 #14
0
        /// <summary>
        /// Replaces the property descriptors for the tracking property.
        /// </summary>
        /// <remarks>
        /// Returned descriptors allow the properties to be reset with tracked value and resume tracking once modified.
        /// </remarks>
        internal PropertyDescriptorCollection ReplaceTrackingPropertyDescriptors(PropertyDescriptorCollection properties)
        {
            // Replace the existing descriptor for the DisplayName property
            DomainPropertyInfo displayNameProperty         = this.Store.DomainDataDirectory.GetDomainProperty(NamedElementSchema.DisplayNameDomainPropertyId);
            DomainPropertyInfo displayNameTrackingProperty = this.Store.DomainDataDirectory.GetDomainProperty(NamedElementSchema.IsDisplayNameTrackingDomainPropertyId);
            var displayNameDescriptor = properties[Reflector <NamedElementSchema> .GetProperty(e => e.DisplayName).Name];

            if (displayNameDescriptor != null)
            {
                properties.Remove(displayNameDescriptor);
                properties.Add(new TrackingPropertyDescriptor(this, displayNameProperty, displayNameTrackingProperty,
                                                              displayNameDescriptor.Attributes.Cast <Attribute>().ToArray <Attribute>()));
            }

            return(properties);
        }
            /// <summary>
            /// Reset the value to the value of the refined generator
            /// </summary>
            public override void ResetValue(object component)
            {
                NameGenerator generator       = (NameGenerator)component;
                NameGenerator parentGenerator = generator.RefinesGenerator;

                if (parentGenerator != null)
                {
                    // This gives a different transaction name that the default ResetValue, but
                    // the correct string is not accessible and the duplication is not worth the effort
                    base.SetValue(component, DomainPropertyInfo.GetValue(parentGenerator));
                }
                else
                {
                    base.ResetValue(component);
                }
            }
        /// <summary>
        ///    Returns the property descriptors for the described ModelClass domain class, adding tracking property
        ///    descriptor(s).
        /// </summary>
        private PropertyDescriptorCollection GetCustomProperties(Attribute[] attributes)
        {
            // Get the default property descriptors from the base class
            PropertyDescriptorCollection propertyDescriptors = base.GetProperties(attributes);

            // Get a reference to the model element that is being described.
            ModelClass modelClass = ModelElement as ModelClass;

            //Add the descriptor for the tracking property.
            if (modelClass != null)
            {
                storeDomainDataDirectory = modelClass.Store.DomainDataDirectory;

                /********************************************************************************/

                DomainPropertyInfo databaseSchemaPropertyInfo           = storeDomainDataDirectory.GetDomainProperty(ModelClass.DatabaseSchemaDomainPropertyId);
                DomainPropertyInfo isDatabaseSchemaTrackingPropertyInfo = storeDomainDataDirectory.GetDomainProperty(ModelClass.IsDatabaseSchemaTrackingDomainPropertyId);

                // Define attributes for the tracking property/properties so that the Properties window displays them correctly.
                Attribute[] databaseSchemaAttributes =
                {
                    new DisplayNameAttribute("Database Schema"),
                    new DescriptionAttribute("The schema to use for table creation. Overrides default schema for model if present."),
                    new CategoryAttribute("Database")
                };

                propertyDescriptors.Add(new TrackingPropertyDescriptor(modelClass, databaseSchemaPropertyInfo, isDatabaseSchemaTrackingPropertyInfo, databaseSchemaAttributes));

                /********************************************************************************/

                DomainPropertyInfo namespacePropertyInfo           = storeDomainDataDirectory.GetDomainProperty(ModelClass.NamespaceDomainPropertyId);
                DomainPropertyInfo isNamespaceTrackingPropertyInfo = storeDomainDataDirectory.GetDomainProperty(ModelClass.IsNamespaceTrackingDomainPropertyId);

                // Define attributes for the tracking property/properties so that the Properties window displays them correctly.
                Attribute[] namespaceAttributes =
                {
                    new DisplayNameAttribute("Namespace"),
                    new DescriptionAttribute("Overrides default namespace"),
                    new CategoryAttribute("Code Generation")
                };

                propertyDescriptors.Add(new TrackingPropertyDescriptor(modelClass, namespacePropertyInfo, isNamespaceTrackingPropertyInfo, namespaceAttributes));
            }

            // Return the property descriptors for this element
            return(propertyDescriptors);
        }
예제 #17
0
        /// <summary>
        /// Manages <see cref="EventHandler{TEventArgs}"/>s in the <see cref="Store"/> for <see cref="BarkerEntityShape"/>s.
        /// </summary>
        /// <param name="store">The <see cref="Store"/> for which the <see cref="EventHandler{TEventArgs}"/>s should be managed.</param>
        /// <param name="eventManager">The <see cref="ModelingEventManager"/> used to manage the <see cref="EventHandler{TEventArgs}"/>s.</param>
        /// <param name="action">The <see cref="EventHandlerAction"/> that should be taken for the <see cref="EventHandler{TEventArgs}"/>s.</param>
        public static void ManageEventHandlers(Store store, ModelingEventManager eventManager, EventHandlerAction action)
        {
            DomainDataDirectory dataDirectory = store.DomainDataDirectory;
            DomainPropertyInfo  propertyInfo  = dataDirectory.FindDomainProperty(BarkerEntityShape.UpdateCounterDomainPropertyId);

            eventManager.AddOrRemoveHandler(propertyInfo, new EventHandler <ElementPropertyChangedEventArgs>(UpdateShapeEvent), action);

            if (action == EventHandlerAction.Add)
            {
                // We don't want this rule on. This forces a full repopulation of the compartment,
                // which makes it impossible to determine the old index of a selected item. If this is
                // on, then the ColumnRenamedEvent does not work for the initial transaction.
                store.RuleManager.DisableRule(typeof(CompartmentItemChangeRule));
            }
            propertyInfo = dataDirectory.FindDomainProperty(Barker.Attribute.NameDomainPropertyId);
            eventManager.AddOrRemoveHandler(propertyInfo, new EventHandler <ElementPropertyChangedEventArgs>(AttributeRenamedEvent), action);
        }
예제 #18
0
        /// <summary>
        /// Add or remove an event handler. Use in place of the Add and Remove methods available through
        /// <see cref="EventManagerDirectory.ElementPropertyChanged"/>. Set the addHandler parameter to true for an Add
        /// and false for a remove.
        /// </summary>
        public void AddOrRemoveHandler(DomainPropertyInfo domainProperty, EventHandler <ElementPropertyChangedEventArgs> handler, EventHandlerAction action)
        {
            bool     addHandler      = action == EventHandlerAction.Add;
            Delegate wrapperDelegate = AddOrRemove <ElementPropertyChangedEventArgs>(domainProperty, handler, addHandler);

            if (wrapperDelegate != null)
            {
                if (addHandler)
                {
                    myStore.EventManagerDirectory.ElementPropertyChanged.Add(domainProperty, wrapperDelegate);
                }
                else
                {
                    myStore.EventManagerDirectory.ElementPropertyChanged.Remove(domainProperty, wrapperDelegate);
                }
            }
        }
예제 #19
0
        /// <summary>
        /// Constuctor.
        /// </summary>
        /// <param name="viewModelStore">The store this view model belongs to.</param>
        /// <param name="dependencyItem">The model element that is hosted by this view model.</param>
        /// <param name="bSubscribeToEvents">True if updates on elements name changes are needed.</param>
        public DependencyItemViewModel(ViewModelStore viewModelStore, DependencyItem dependencyItem, bool bSubscribeToEvents)
            : base(viewModelStore)
        {
            if (dependencyItem == null)
            {
                throw new ArgumentNullException("dependencyItem");
            }

            this.dependencyItem      = dependencyItem;
            this.doSubscribeToEvents = bSubscribeToEvents;

            if (this.doSubscribeToEvents)
            {
                // subscribe
                if ((dependencyItem.SourceElement is IDomainModelOwnable))
                {
                    if ((dependencyItem.SourceElement as IDomainModelOwnable).DomainElementHasName)
                    {
                        DomainPropertyInfo info = this.ViewModelStore.GetDomainModelServices(dependencyItem.SourceElement).ElementNameProvider.GetNamePropertyInfo(dependencyItem.SourceElement);
                        this.ViewModelStore.EventManager.GetEvent <ModelElementPropertyChangedEvent>().Subscribe(info, dependencyItem.SourceElement.Id, OnSourceNamePropertyChanged);
                    }
                }


                if ((dependencyItem.TargetElement is IDomainModelOwnable))
                {
                    if ((dependencyItem.TargetElement as IDomainModelOwnable).DomainElementHasName)
                    {
                        DomainPropertyInfo info = this.ViewModelStore.GetDomainModelServices(dependencyItem.TargetElement).ElementNameProvider.GetNamePropertyInfo(dependencyItem.TargetElement);
                        this.ViewModelStore.EventManager.GetEvent <ModelElementPropertyChangedEvent>().Subscribe(info, dependencyItem.TargetElement.Id, OnTargetNamePropertyChanged);
                    }
                }

                /*if (this.ViewModelStore.GetDomainModelServices(dependencyItem.SourceElement).ElementNameProvider.HasName(dependencyItem.SourceElement))
                 * {
                 *  DomainPropertyInfo info = this.ViewModelStore.GetDomainModelServices(dependencyItem.SourceElement).ElementNameProvider.GetNamePropertyInfo(dependencyItem.SourceElement);
                 *  this.ViewModelStore.EventManager.GetEvent<ModelElementPropertyChangedEvent>().Subscribe(info, dependencyItem.SourceElement.Id, OnSourceNamePropertyChanged);
                 * }
                 * if (this.ViewModelStore.GetDomainModelServices(dependencyItem.TargetElement).ElementNameProvider.HasName(dependencyItem.TargetElement))
                 * {
                 *  DomainPropertyInfo info = this.ViewModelStore.GetDomainModelServices(dependencyItem.TargetElement).ElementNameProvider.GetNamePropertyInfo(dependencyItem.TargetElement);
                 *  this.ViewModelStore.EventManager.GetEvent<ModelElementPropertyChangedEvent>().Subscribe(info, dependencyItem.TargetElement.Id, OnTargetNamePropertyChanged);
                 * }*/
            }
        }
예제 #20
0
 /// <summary>
 /// Unsubscribes from a specific event.
 /// </summary>
 /// <param name="domainPropertyInfo">Domain property info specifying when to unsubscribe.</param>
 /// <param name="action">Action identifying what to unsubscribe.</param>
 public void Unsubscribe(DomainPropertyInfo domainPropertyInfo, Action <ElementPropertyChangedEventArgs> action)
 {
     lock (dictionaryOnPropertyInfo)
     {
         if (dictionaryOnPropertyInfo.Keys.Contains(domainPropertyInfo.Id))
         {
             IEventSubscription eventSubscription = dictionaryOnPropertyInfo[domainPropertyInfo.Id].Cast <EventSubscription <ElementPropertyChangedEventArgs> >().FirstOrDefault(evt => evt.Action == action);
             if (eventSubscription != null)
             {
                 dictionaryOnPropertyInfo[domainPropertyInfo.Id].Remove(eventSubscription);
                 if (dictionaryOnPropertyInfo[domainPropertyInfo.Id].Count == 0)
                 {
                     dictionaryOnPropertyInfo.Remove(domainPropertyInfo.Id);
                 }
             }
         }
     }
 }
예제 #21
0
 private static void PropagateChange(NameGenerator parentGenerator, DomainPropertyInfo propertyInfo, object oldValue, object newValue, Type nameUsageType)
 {
     foreach (NameGenerator refinement in parentGenerator.RefinedByGeneratorCollection)
     {
         Type refinementUsage = refinement.NameUsageType;
         if (refinementUsage == null)
         {
             // Make sure we skip the level to get the corresponding usages
             PropagateChange(refinement, propertyInfo, oldValue, newValue, nameUsageType);
         }
         else if (refinementUsage == nameUsageType &&
                  propertyInfo.GetValue(refinement).Equals(oldValue))
         {
             propertyInfo.SetValue(refinement, newValue);
             PropagateChange(refinement, propertyInfo, oldValue, newValue, nameUsageType);
         }
     }
 }
예제 #22
0
        /// <summary>
        /// Add a <c>Name</c> property for the associated <see cref="MandatoryConstraint"/> if an
        /// <see cref="ExclusiveOrConstraintCoupler"/> is attached to this <see cref="ExclusionConstraint"/>.
        /// </summary>
        public override PropertyDescriptorCollection GetProperties(Attribute[] attributes)
        {
            PropertyDescriptorCollection properties          = base.GetProperties(attributes);
            MandatoryConstraint          mandatoryConstraint = ModelElement.ExclusiveOrMandatoryConstraint;

            if (mandatoryConstraint != null)
            {
                DomainPropertyInfo mandatoryConstraintNameDomainProperty = mandatoryConstraint.GetDomainClass().NameDomainProperty;
                properties.Add(EditorUtility.RedirectPropertyDescriptor(
                                   mandatoryConstraint,
                                   new ElementPropertyDescriptor(
                                       mandatoryConstraint,
                                       mandatoryConstraintNameDomainProperty,
                                       base.GetDomainPropertyAttributes(mandatoryConstraintNameDomainProperty)),
                                   typeof(ExclusionConstraint)));
            }
            return(properties);
        }
예제 #23
0
        /// <summary>
        /// Creates a <see cref="PropertyDescriptor"/> for the <see cref="DomainPropertyInfo"/> or
        /// <see cref="DomainRoleInfo"/> with a <see cref="DomainObjectInfo.Id"/> equal to
        /// <paramref name="domainPropertyOrRoleId"/>.
        /// </summary>
        /// <param name="element">
        /// The instance of <see cref="ModelElement"/> containing the property for which a
        /// <see cref="PropertyDescriptor"/> should be created.
        /// </param>
        /// <param name="domainPropertyOrRoleId">
        /// The <see cref="DomainObjectInfo.Id"/> of the <see cref="DomainPropertyInfo"/> or
        /// <see cref="DomainRoleInfo"/> for which a <see cref="PropertyDescriptor"/> should
        /// be created.
        /// </param>
        /// <returns>
        /// A <see cref="PropertyDescriptor"/> for the <see cref="DomainPropertyInfo"/> or
        /// <see cref="DomainRoleInfo"/> with a <see cref="DomainObjectInfo.Id"/> equal to
        /// <paramref name="domainPropertyOrRoleId"/>.
        /// </returns>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="element"/> is <see langword="null"/>.
        /// </exception>
        /// <exception cref="DomainDataNotFoundException">
        /// Neither a <see cref="DomainPropertyInfo"/> nor a <see cref="DomainRoleInfo"/>
        /// with a <see cref="DomainObjectInfo.Id"/> equal to
        /// <paramref name="domainPropertyOrRoleId"/> could be found.
        /// </exception>
        public static PropertyDescriptor CreatePropertyDescriptor(ModelElement element, Guid domainPropertyOrRoleId)
        {
            if (element == null)
            {
                throw new ArgumentNullException("element");
            }
            DomainDataDirectory domainDataDirectory = element.Store.DomainDataDirectory;
            DomainPropertyInfo  domainPropertyInfo  = domainDataDirectory.FindDomainProperty(domainPropertyOrRoleId);

            if (domainPropertyInfo != null)
            {
                return(DomainTypeDescriptor.CreatePropertyDescriptor(element, domainPropertyInfo));
            }
            else
            {
                return(DomainTypeDescriptor.CreatePropertyDescriptor(element, domainDataDirectory.GetDomainRole(domainPropertyOrRoleId)));
            }
        }
예제 #24
0
 /// <summary>Implements ICustomSerializedElement.GetCustomSerializedPropertyInfo</summary>
 protected CustomSerializedPropertyInfo GetCustomSerializedPropertyInfo(DomainPropertyInfo domainPropertyInfo, DomainRoleInfo rolePlayedInfo)
 {
     if (domainPropertyInfo.Id == BarkerERDiagram.IsCompleteViewDomainPropertyId)
     {
         return(new CustomSerializedPropertyInfo(null, null, null, false, CustomSerializedAttributeWriteStyle.NotWritten, null));
     }
     if (domainPropertyInfo.Id == BarkerERDiagram.NameDomainPropertyId)
     {
         return(new CustomSerializedPropertyInfo(null, null, null, false, CustomSerializedAttributeWriteStyle.NotWritten, null));
     }
     if (domainPropertyInfo.Id == BarkerERDiagram.BaseFontNameDomainPropertyId)
     {
         return(new CustomSerializedPropertyInfo(null, null, null, false, CustomSerializedAttributeWriteStyle.NotWritten, null));
     }
     if (domainPropertyInfo.Id == BarkerERDiagram.BaseFontSizeDomainPropertyId)
     {
         return(new CustomSerializedPropertyInfo(null, null, null, false, CustomSerializedAttributeWriteStyle.NotWritten, null));
     }
     if (domainPropertyInfo.Id == BarkerERDiagram.DiagramIdDomainPropertyId)
     {
         return(new CustomSerializedPropertyInfo(null, null, null, false, CustomSerializedAttributeWriteStyle.NotWritten, null));
     }
     if (domainPropertyInfo.Id == BarkerERDiagram.DoLineRoutingDomainPropertyId)
     {
         return(new CustomSerializedPropertyInfo(null, null, null, false, CustomSerializedAttributeWriteStyle.NotWritten, null));
     }
     if (domainPropertyInfo.Id == BarkerERDiagram.DoResizeParentDomainPropertyId)
     {
         return(new CustomSerializedPropertyInfo(null, null, null, false, CustomSerializedAttributeWriteStyle.NotWritten, null));
     }
     if (domainPropertyInfo.Id == BarkerERDiagram.DoShapeAnchoringDomainPropertyId)
     {
         return(new CustomSerializedPropertyInfo(null, null, null, false, CustomSerializedAttributeWriteStyle.NotWritten, null));
     }
     if (domainPropertyInfo.Id == BarkerERDiagram.DoViewFixupDomainPropertyId)
     {
         return(new CustomSerializedPropertyInfo(null, null, null, false, CustomSerializedAttributeWriteStyle.NotWritten, null));
     }
     if (domainPropertyInfo.Id == BarkerERDiagram.PlaceUnplacedShapesDomainPropertyId)
     {
         return(new CustomSerializedPropertyInfo(null, null, null, false, CustomSerializedAttributeWriteStyle.NotWritten, null));
     }
     return(CustomSerializedPropertyInfo.Default);
 }
        /// <summary>
        /// Clean up.
        /// </summary>
        protected override void OnDispose()
        {
            if (this.bHookUpEvents)
            {
                if (element != null)
                {
                    DomainPropertyInfo info = element.GetDomainClass().NameDomainProperty;
                    if (info != null)
                    {
                        this.EventManager.GetEvent <ModelElementPropertyChangedEvent>().Unsubscribe(
                            info, this.Element.Id, new System.Action <ElementPropertyChangedEventArgs>(NamePropertyChanged));
                    }
                }
            }

            base.OnDispose();

            this.element = null;
        }
예제 #26
0
        /// <summary>
        /// Subscribes to the property changed event. Observers are notified, whenever a property of a specific type
        /// changes on a model element of a specific type.
        /// </summary>
        /// <param name="domainPropertyInfo">Property info specifying a property type, which changes cause a notification.</param>
        /// <param name="domainClassInfo">
        /// Domain class info specifying the type of model element, which property changes cause a notification (All derived
        /// model element types are included).
        /// </param>
        /// <param name="action">Action to call on the observer.</param>
        public void Subscribe(DomainClassInfo domainClassInfo, DomainPropertyInfo domainPropertyInfo, Action <ElementPropertyChangedEventArgs> action)
        {
            IDelegateReference actionReference = new DelegateReference(action, false);
            IDelegateReference filterReference = new DelegateReference(new Predicate <ElementPropertyChangedEventArgs>(delegate { return(true); }), true);
            IEventSubscription subscription    = new EventSubscription <ElementPropertyChangedEventArgs>(actionReference, filterReference);

            lock (dictionaryOnClassInfoPropertyInfo)
            {
                Guid domainClassId    = domainClassInfo.Id;
                Guid domainPropertyId = domainPropertyInfo.Id;

                if (!dictionaryOnClassInfoPropertyInfo.Keys.Contains(domainClassId))
                {
                    dictionaryOnClassInfoPropertyInfo.Add(domainClassId, new Dictionary <Guid, List <IEventSubscription> >());
                }

                if (!dictionaryOnClassInfoPropertyInfo[domainClassId].Keys.Contains(domainPropertyId))
                {
                    dictionaryOnClassInfoPropertyInfo[domainClassId].Add(domainPropertyId, new List <IEventSubscription>());
                }

                dictionaryOnClassInfoPropertyInfo[domainClassId][domainPropertyId].Add(subscription);

                // continue with descendants
                foreach (DomainClassInfo info in domainClassInfo.AllDescendants)
                {
                    domainClassId = info.Id;

                    if (!dictionaryOnClassInfoPropertyInfo.Keys.Contains(domainClassId))
                    {
                        dictionaryOnClassInfoPropertyInfo.Add(domainClassId, new Dictionary <Guid, List <IEventSubscription> >());
                    }

                    if (!dictionaryOnClassInfoPropertyInfo[domainClassId].Keys.Contains(domainPropertyId))
                    {
                        dictionaryOnClassInfoPropertyInfo[domainClassId].Add(domainPropertyId, new List <IEventSubscription>());
                    }

                    dictionaryOnClassInfoPropertyInfo[domainClassId][domainPropertyId].Add(subscription);
                }
            }
        }
 /// <summary>Implements ICustomSerializedElement.GetCustomSerializedPropertyInfo</summary>
 protected CustomSerializedPropertyInfo GetCustomSerializedPropertyInfo(DomainPropertyInfo domainPropertyInfo, DomainRoleInfo rolePlayedInfo)
 {
     if (domainPropertyInfo.Id == FactTypeMapsTowardsRole.MandatoryPatternDomainPropertyId)
     {
         if (MappingMandatoryPattern.None == this.MandatoryPattern)
         {
             return(new CustomSerializedPropertyInfo(null, null, null, false, CustomSerializedAttributeWriteStyle.NotWritten, null));
         }
         return(new CustomSerializedPropertyInfo(null, null, null, false, CustomSerializedAttributeWriteStyle.Attribute, null));
     }
     if (domainPropertyInfo.Id == FactTypeMapsTowardsRole.UniquenessPatternDomainPropertyId)
     {
         if (MappingUniquenessPattern.None == this.UniquenessPattern)
         {
             return(new CustomSerializedPropertyInfo(null, null, null, false, CustomSerializedAttributeWriteStyle.NotWritten, null));
         }
         return(new CustomSerializedPropertyInfo(null, null, null, false, CustomSerializedAttributeWriteStyle.Attribute, null));
     }
     return(CustomSerializedPropertyInfo.Default);
 }
예제 #28
0
        /// <summary>
        /// Gets the property assignments based on the element this proto element represents.
        /// </summary>
        /// <param name="partition">Partition to use.</param>
        /// <param name="elementId">Id to assign to the IdPropertyAssignment.</param>
        /// <returns>Array of property assignments.</returns>
        public PropertyAssignment[] GetPropertyAssignments(Partition partition, Guid elementId)
        {
            if (partition == null)
            {
                throw new System.ArgumentNullException("partition");
            }

            int length = properties.Count + 1;

            PropertyAssignment[] propertyAssignmentArr = new PropertyAssignment[length];
            for (int i = 0; i < properties.Count; i++)
            {
                ModelProtoPropertyValue protoPropertyValue = (ModelProtoPropertyValue)properties[i];
                DomainPropertyInfo      domainPropertyInfo = partition.DomainDataDirectory.FindDomainProperty(protoPropertyValue.DomainPropertyId);
                propertyAssignmentArr[i] = new PropertyAssignment(protoPropertyValue.DomainPropertyId, protoPropertyValue.PropertyValue);
            }

            propertyAssignmentArr[properties.Count] = new PropertyAssignment(ElementFactory.IdPropertyAssignment, elementId);

            return(propertyAssignmentArr);
        }
예제 #29
0
        /// <summary>
        /// Gets the value of the DomainElementSettingType property.
        /// </summary>
        internal CustomizableDomainElementSettingType GetDomainElementSettingTypeValue()
        {
            // Determine whether the current name is a DomainProperty or a DomainRole
            CustomizableElementSchema element = this.Policy.Owner;

            if (element != null)
            {
                DomainPropertyInfo domainPropertyInfo = element.GetDomainClass().FindDomainProperty(this.PropertyId, true);
                if (domainPropertyInfo != null)
                {
                    return(CustomizableDomainElementSettingType.DomainProperty);
                }
                else
                {
                    // Must be a domain role property
                    return(CustomizableDomainElementSettingType.DomainRole);
                }
            }

            return(CustomizableDomainElementSettingType.DomainProperty);
        }
예제 #30
0
        /// <summary>
        /// Manages <see cref="EventHandler{TEventArgs}"/>s in the <see cref="Store"/> for <see cref="TableShape"/>s.
        /// </summary>
        /// <param name="store">The <see cref="Store"/> for which the <see cref="EventHandler{TEventArgs}"/>s should be managed.</param>
        /// <param name="eventManager">The <see cref="ModelingEventManager"/> used to manage the <see cref="EventHandler{TEventArgs}"/>s.</param>
        /// <param name="action">The <see cref="EventHandlerAction"/> that should be taken for the <see cref="EventHandler{TEventArgs}"/>s.</param>
        public static void ManageEventHandlers(Store store, ModelingEventManager eventManager, EventHandlerAction action)
        {
            DomainDataDirectory dataDirectory = store.DomainDataDirectory;
            DomainPropertyInfo  propertyInfo  = dataDirectory.FindDomainProperty(TableShape.UpdateCounterDomainPropertyId);

            eventManager.AddOrRemoveHandler(propertyInfo, new EventHandler <ElementPropertyChangedEventArgs>(UpdateShapeEvent), action);

            if (action == EventHandlerAction.Add)
            {
                // We don't want this rule on. This forces a full repopulation of the compartment,
                // which makes it impossible to determine the old index of a selected item. If this is
                // on, then the ColumnRenamedEvent does not work for the initial transaction.
                store.RuleManager.DisableRule(typeof(CompartmentItemChangeRule));
            }
#if CUSTOMSORT
            propertyInfo = dataDirectory.FindDomainProperty(Column.NameDomainPropertyId);
            eventManager.AddOrRemoveHandler(propertyInfo, new EventHandler <ElementPropertyChangedEventArgs>(ColumnRenamedEvent), action);
#else // CUSTOMSORT
            eventManager.AddOrRemoveHandler(dataDirectory.FindDomainRole(TableContainsColumn.ColumnDomainRoleId), new EventHandler <RolePlayerOrderChangedEventArgs>(ColumnOrderChanged), action);
#endif // CUSTOMSORT
        }
        /// <summary>
        /// Clean up.
        /// </summary>
        protected override void OnDispose()
        {
            if (message.Source is IDomainModelOwnable)
            {
                if ((message.Source as IDomainModelOwnable).DomainElementHasName)
                {
                    try
                    {
                        DomainPropertyInfo info = this.ViewModelStore.GetDomainModelServices(message.Source).ElementNameProvider.GetNamePropertyInfo(message.Source);
                        this.ViewModelStore.EventManager.GetEvent <ModelElementPropertyChangedEvent>().Unsubscribe(info, message.Source.Id, OnNamePropertyChanged);
                    }
                    catch {}
                }
            }

            this.ViewModelStore.EventManager.GetEvent <ModelElementDeletedEvent>().Unsubscribe(message.Source.Id, OnElementDeleted);

            this.message = null;

            base.OnDispose();
        }
		/// <summary>
		/// Create a new <see cref="AutomatedElementFilterPropertyDescriptor"/>
		/// </summary>
		public AutomatedElementFilterPropertyDescriptor(ElementTypeDescriptor owner, ModelElement modelElement, DomainPropertyInfo domainProperty, Attribute[] attributes)
			: base(owner, modelElement, domainProperty, attributes)
		{
		}
		/// <summary>Implements ICustomSerializedElement.GetCustomSerializedPropertyInfo</summary>
		CustomSerializedPropertyInfo ICustomSerializedElement.GetCustomSerializedPropertyInfo(DomainPropertyInfo domainPropertyInfo, DomainRoleInfo rolePlayedInfo)
		{
			if (domainPropertyInfo.Id == DiagramDisplay.SaveDiagramPositionDomainPropertyId)
			{
				if (!this.SaveDiagramPosition)
				{
					return new CustomSerializedPropertyInfo(null, null, null, false, CustomSerializedAttributeWriteStyle.Attribute, null);
				}
				return new CustomSerializedPropertyInfo(null, null, null, false, CustomSerializedAttributeWriteStyle.Attribute, null);
			}
			return CustomSerializedPropertyInfo.Default;
		}
		/// <summary>Implements ICustomSerializedElement.GetCustomSerializedPropertyInfo</summary>
		protected CustomSerializedPropertyInfo GetCustomSerializedPropertyInfo(DomainPropertyInfo domainPropertyInfo, DomainRoleInfo rolePlayedInfo)
		{
			if (domainPropertyInfo.Id == DiagramDisplayHasDiagramOrder.IsActiveDiagramDomainPropertyId)
			{
				if (this.IsActiveDiagram && this.DiagramDisplay.SaveDiagramPosition)
				{
					return new CustomSerializedPropertyInfo(null, "IsActive", null, true, CustomSerializedAttributeWriteStyle.Attribute, null);
				}
				return new CustomSerializedPropertyInfo(null, null, null, false, CustomSerializedAttributeWriteStyle.NotWritten, null);
			}
			if (domainPropertyInfo.Id == DiagramDisplayHasDiagramOrder.CenterPointDomainPropertyId)
			{
				if (!this.CenterPoint.IsEmpty && this.DiagramDisplay.SaveDiagramPosition)
				{
					return new CustomSerializedPropertyInfo(null, null, null, true, CustomSerializedAttributeWriteStyle.Attribute, null);
				}
				return new CustomSerializedPropertyInfo(null, null, null, false, CustomSerializedAttributeWriteStyle.NotWritten, null);
			}
			if (domainPropertyInfo.Id == DiagramDisplayHasDiagramOrder.ZoomFactorDomainPropertyId)
			{
				if (this.ZoomFactor != 1F && this.DiagramDisplay.SaveDiagramPosition)
				{
					return new CustomSerializedPropertyInfo(null, null, null, true, CustomSerializedAttributeWriteStyle.Attribute, null);
				}
				return new CustomSerializedPropertyInfo(null, null, null, false, CustomSerializedAttributeWriteStyle.NotWritten, null);
			}
			return CustomSerializedPropertyInfo.Default;
		}
		/// <summary>Implements ICustomSerializedElement.GetCustomSerializedPropertyInfo</summary>
		protected CustomSerializedPropertyInfo GetCustomSerializedPropertyInfo(DomainPropertyInfo domainPropertyInfo, DomainRoleInfo rolePlayedInfo)
		{
			if (domainPropertyInfo.Id == BarkerErModel.NameDomainPropertyId)
			{
				if (string.IsNullOrEmpty(this.Name))
				{
					return new CustomSerializedPropertyInfo(null, null, null, false, CustomSerializedAttributeWriteStyle.NotWritten, null);
				}
				return new CustomSerializedPropertyInfo(null, null, null, false, CustomSerializedAttributeWriteStyle.Attribute, null);
			}
			return CustomSerializedPropertyInfo.Default;
		}
		/// <summary>Implements ICustomSerializedElement.GetCustomSerializedPropertyInfo</summary>
		protected CustomSerializedPropertyInfo GetCustomSerializedPropertyInfo(DomainPropertyInfo domainPropertyInfo, DomainRoleInfo rolePlayedInfo)
		{
			if (domainPropertyInfo.Id == Role.IsNonTransferableDomainPropertyId)
			{
				if (!this.IsNonTransferable)
				{
					return new CustomSerializedPropertyInfo(null, null, null, false, CustomSerializedAttributeWriteStyle.NotWritten, null);
				}
				return new CustomSerializedPropertyInfo(null, null, null, false, CustomSerializedAttributeWriteStyle.Attribute, null);
			}
			if (domainPropertyInfo.Id == Role.IsMandatoryDomainPropertyId)
			{
				if (!this.IsMandatory)
				{
					return new CustomSerializedPropertyInfo(null, null, null, false, CustomSerializedAttributeWriteStyle.NotWritten, null);
				}
				return new CustomSerializedPropertyInfo(null, null, null, false, CustomSerializedAttributeWriteStyle.Attribute, null);
			}
			if (domainPropertyInfo.Id == Role.IsPrimaryIdComponentDomainPropertyId)
			{
				if (!this.IsPrimaryIdComponent)
				{
					return new CustomSerializedPropertyInfo(null, null, null, false, CustomSerializedAttributeWriteStyle.NotWritten, null);
				}
				return new CustomSerializedPropertyInfo(null, null, null, false, CustomSerializedAttributeWriteStyle.Attribute, null);
			}
			if (domainPropertyInfo.Id == Role.IsMultiValuedDomainPropertyId)
			{
				if (!this.IsMultiValued)
				{
					return new CustomSerializedPropertyInfo(null, null, null, false, CustomSerializedAttributeWriteStyle.NotWritten, null);
				}
				return new CustomSerializedPropertyInfo(null, null, null, false, CustomSerializedAttributeWriteStyle.Attribute, null);
			}
			return CustomSerializedPropertyInfo.Default;
		}
		CustomSerializedPropertyInfo ICustomSerializedElement.GetCustomSerializedPropertyInfo(DomainPropertyInfo domainPropertyInfo, DomainRoleInfo rolePlayedInfo)
		{
			return this.GetCustomSerializedPropertyInfo(domainPropertyInfo, rolePlayedInfo);
		}
		/// <summary>Implements ICustomSerializedElement.GetCustomSerializedPropertyInfo</summary>
		protected CustomSerializedPropertyInfo GetCustomSerializedPropertyInfo(DomainPropertyInfo domainPropertyInfo, DomainRoleInfo rolePlayedInfo)
		{
			if (domainPropertyInfo.Id == FactTypeMapsTowardsRole.MandatoryPatternDomainPropertyId)
			{
				if (MappingMandatoryPattern.None == this.MandatoryPattern)
				{
					return new CustomSerializedPropertyInfo(null, null, null, false, CustomSerializedAttributeWriteStyle.NotWritten, null);
				}
				return new CustomSerializedPropertyInfo(null, null, null, false, CustomSerializedAttributeWriteStyle.Attribute, null);
			}
			if (domainPropertyInfo.Id == FactTypeMapsTowardsRole.UniquenessPatternDomainPropertyId)
			{
				if (MappingUniquenessPattern.None == this.UniquenessPattern)
				{
					return new CustomSerializedPropertyInfo(null, null, null, false, CustomSerializedAttributeWriteStyle.NotWritten, null);
				}
				return new CustomSerializedPropertyInfo(null, null, null, false, CustomSerializedAttributeWriteStyle.Attribute, null);
			}
			return CustomSerializedPropertyInfo.Default;
		}
		/// <summary>Implements ICustomSerializedElement.GetCustomSerializedPropertyInfo</summary>
		CustomSerializedPropertyInfo ICustomSerializedElement.GetCustomSerializedPropertyInfo(DomainPropertyInfo domainPropertyInfo, DomainRoleInfo rolePlayedInfo)
		{
			if (domainPropertyInfo.Id == CustomProperty.ValueDomainPropertyId)
			{
				return new CustomSerializedPropertyInfo(null, "value", null, false, CustomSerializedAttributeWriteStyle.Attribute, null);
			}
			return CustomSerializedPropertyInfo.Default;
		}
		/// <summary>Implements ICustomSerializedElement.GetCustomSerializedPropertyInfo</summary>
		CustomSerializedPropertyInfo ICustomSerializedElement.GetCustomSerializedPropertyInfo(DomainPropertyInfo domainPropertyInfo, DomainRoleInfo rolePlayedInfo)
		{
			if (domainPropertyInfo.Id == CustomPropertyDefinition.NameDomainPropertyId)
			{
				return new CustomSerializedPropertyInfo(null, "name", null, false, CustomSerializedAttributeWriteStyle.Attribute, null);
			}
			if (domainPropertyInfo.Id == CustomPropertyDefinition.DescriptionDomainPropertyId)
			{
				if (string.IsNullOrEmpty(this.Description))
				{
					return new CustomSerializedPropertyInfo(null, null, null, false, CustomSerializedAttributeWriteStyle.NotWritten, null);
				}
				return new CustomSerializedPropertyInfo(null, "description", null, false, CustomSerializedAttributeWriteStyle.Attribute, null);
			}
			if (domainPropertyInfo.Id == CustomPropertyDefinition.CategoryDomainPropertyId)
			{
				if (string.IsNullOrEmpty(this.Category))
				{
					return new CustomSerializedPropertyInfo(null, null, null, false, CustomSerializedAttributeWriteStyle.NotWritten, null);
				}
				return new CustomSerializedPropertyInfo(null, "category", null, false, CustomSerializedAttributeWriteStyle.Attribute, null);
			}
			if (domainPropertyInfo.Id == CustomPropertyDefinition.DataTypeDomainPropertyId)
			{
				return new CustomSerializedPropertyInfo(null, "dataType", null, false, CustomSerializedAttributeWriteStyle.Attribute, null);
			}
			if (domainPropertyInfo.Id == CustomPropertyDefinition.DefaultValueDomainPropertyId)
			{
				if (this.DefaultValue == null)
				{
					return new CustomSerializedPropertyInfo(null, null, null, false, CustomSerializedAttributeWriteStyle.NotWritten, null);
				}
				return new CustomSerializedPropertyInfo(null, "defaultValue", null, false, CustomSerializedAttributeWriteStyle.Attribute, null);
			}
			if (domainPropertyInfo.Id == CustomPropertyDefinition.VerbalizeDefaultValueDomainPropertyId)
			{
				if (this.VerbalizeDefaultValue || this.DefaultValue == null)
				{
					return new CustomSerializedPropertyInfo(null, null, null, false, CustomSerializedAttributeWriteStyle.NotWritten, null);
				}
				return new CustomSerializedPropertyInfo(null, "verbalizeDefaultValue", null, false, CustomSerializedAttributeWriteStyle.Attribute, null);
			}
			if (domainPropertyInfo.Id == CustomPropertyDefinition.CustomEnumValueDomainPropertyId)
			{
				if (string.IsNullOrEmpty(this.CustomEnumValue))
				{
					return new CustomSerializedPropertyInfo(null, null, null, false, CustomSerializedAttributeWriteStyle.NotWritten, null);
				}
				return new CustomSerializedPropertyInfo(null, "customEnumValues", null, false, CustomSerializedAttributeWriteStyle.Attribute, null);
			}
			if (domainPropertyInfo.Id == CustomPropertyDefinition.ORMTypesDomainPropertyId)
			{
				return new CustomSerializedPropertyInfo(null, "ORMTypes", null, false, CustomSerializedAttributeWriteStyle.Attribute, null);
			}
			return CustomSerializedPropertyInfo.Default;
		}
		/// <summary>Implements ICustomSerializedElement.GetCustomSerializedPropertyInfo</summary>
		CustomSerializedPropertyInfo ICustomSerializedElement.GetCustomSerializedPropertyInfo(DomainPropertyInfo domainPropertyInfo, DomainRoleInfo rolePlayedInfo)
		{
			if (domainPropertyInfo.Id == CustomPropertyGroup.NameDomainPropertyId)
			{
				return new CustomSerializedPropertyInfo(null, "name", null, false, CustomSerializedAttributeWriteStyle.Attribute, null);
			}
			if (domainPropertyInfo.Id == CustomPropertyGroup.DescriptionDomainPropertyId)
			{
				if (string.IsNullOrEmpty(this.Description))
				{
					return new CustomSerializedPropertyInfo(null, null, null, false, CustomSerializedAttributeWriteStyle.NotWritten, null);
				}
				return new CustomSerializedPropertyInfo(null, "description", null, false, CustomSerializedAttributeWriteStyle.Attribute, null);
			}
			if (domainPropertyInfo.Id == CustomPropertyGroup.IsDefaultDomainPropertyId)
			{
				return new CustomSerializedPropertyInfo(null, "isDefault", null, false, CustomSerializedAttributeWriteStyle.Attribute, null);
			}
			return CustomSerializedPropertyInfo.Default;
		}
		/// <summary>Implements ICustomSerializedElement.GetCustomSerializedPropertyInfo</summary>
		protected CustomSerializedPropertyInfo GetCustomSerializedPropertyInfo(DomainPropertyInfo domainPropertyInfo, DomainRoleInfo rolePlayedInfo)
		{
			throw new NotSupportedException();
		}
		/// <summary>Implements ICustomSerializedElement.GetCustomSerializedPropertyInfo</summary>
		protected CustomSerializedPropertyInfo GetCustomSerializedPropertyInfo(DomainPropertyInfo domainPropertyInfo, DomainRoleInfo rolePlayedInfo)
		{
			if (domainPropertyInfo.Id == BarkerERDiagram.IsCompleteViewDomainPropertyId)
			{
				return new CustomSerializedPropertyInfo(null, null, null, false, CustomSerializedAttributeWriteStyle.NotWritten, null);
			}
			if (domainPropertyInfo.Id == BarkerERDiagram.NameDomainPropertyId)
			{
				return new CustomSerializedPropertyInfo(null, null, null, false, CustomSerializedAttributeWriteStyle.NotWritten, null);
			}
			if (domainPropertyInfo.Id == BarkerERDiagram.BaseFontNameDomainPropertyId)
			{
				return new CustomSerializedPropertyInfo(null, null, null, false, CustomSerializedAttributeWriteStyle.NotWritten, null);
			}
			if (domainPropertyInfo.Id == BarkerERDiagram.BaseFontSizeDomainPropertyId)
			{
				return new CustomSerializedPropertyInfo(null, null, null, false, CustomSerializedAttributeWriteStyle.NotWritten, null);
			}
			if (domainPropertyInfo.Id == BarkerERDiagram.DiagramIdDomainPropertyId)
			{
				return new CustomSerializedPropertyInfo(null, null, null, false, CustomSerializedAttributeWriteStyle.NotWritten, null);
			}
			if (domainPropertyInfo.Id == BarkerERDiagram.DoLineRoutingDomainPropertyId)
			{
				return new CustomSerializedPropertyInfo(null, null, null, false, CustomSerializedAttributeWriteStyle.NotWritten, null);
			}
			if (domainPropertyInfo.Id == BarkerERDiagram.DoResizeParentDomainPropertyId)
			{
				return new CustomSerializedPropertyInfo(null, null, null, false, CustomSerializedAttributeWriteStyle.NotWritten, null);
			}
			if (domainPropertyInfo.Id == BarkerERDiagram.DoShapeAnchoringDomainPropertyId)
			{
				return new CustomSerializedPropertyInfo(null, null, null, false, CustomSerializedAttributeWriteStyle.NotWritten, null);
			}
			if (domainPropertyInfo.Id == BarkerERDiagram.DoViewFixupDomainPropertyId)
			{
				return new CustomSerializedPropertyInfo(null, null, null, false, CustomSerializedAttributeWriteStyle.NotWritten, null);
			}
			if (domainPropertyInfo.Id == BarkerERDiagram.PlaceUnplacedShapesDomainPropertyId)
			{
				return new CustomSerializedPropertyInfo(null, null, null, false, CustomSerializedAttributeWriteStyle.NotWritten, null);
			}
			return CustomSerializedPropertyInfo.Default;
		}