예제 #1
0
        private Defaultable <AssociationOnRemoveAction> GetDefaultableOnRemoveAction(bool onOwnerRemove)
        {
            var defaultable = new Defaultable <AssociationOnRemoveAction>();
            AssociationOnRemoveAction associationOnRemoveAction = onOwnerRemove ? this.OnOwnerRemove : this.OnTargetRemove;

            if (associationOnRemoveAction != AssociationOnRemoveAction.Default)
            {
                defaultable.SetAsCustom(associationOnRemoveAction);
            }
            else
            {
                defaultable.SetAsDefault();
            }
            return(defaultable);
        }
예제 #2
0
        public override object CreateInstance(ITypeDescriptorContext context, IDictionary propertyValues)
        {
            ModelElement      owner      = context.Instance as ModelElement;
            OrmAssociationEnd currentObj = (OrmAssociationEnd)context.PropertyDescriptor.GetValue(context.Instance);

            MultiplicityKind          otherMultiplicity   = (MultiplicityKind)propertyValues["Multiplicity"];
            AssociationOnRemoveAction otherOnOwnerRemove  = (AssociationOnRemoveAction)propertyValues["OnOwnerRemove"];
            AssociationOnRemoveAction otherOnTargetRemove = (AssociationOnRemoveAction)propertyValues["OnTargetRemove"];
            Defaultable <string>      otherPairTo         = (Defaultable <string>)propertyValues["PairTo"];
            bool useAssociationAttribute = (bool)propertyValues["UseAssociationAttribute"];

            bool changedMultiplicity = currentObj.Multiplicity != otherMultiplicity;
            bool changedPairTo       = !currentObj.PairTo.EqualsTo(otherPairTo);

            string endId = context.PropertyDescriptor.Name;

            OrmAssociationEnd result = new OrmAssociationEnd(owner, endId)
            {
                multiplicity            = otherMultiplicity,
                OnOwnerRemove           = otherOnOwnerRemove,
                OnTargetRemove          = otherOnTargetRemove,
                pairTo                  = otherPairTo,
                UseAssociationAttribute = useAssociationAttribute
            };

//            if (changedMultiplicity)
//            {
//                result.NotifyValueChangeToOwner("Multiplicity");
//            }

            //if (changedPairTo)
            {
                result.NotifyValueChangeToOwner(string.Empty, endId);
            }

            return(result);
        }
예제 #3
0
        private ResultData GetResultData()
        {
            PersistentTypeItem persistentTypeEnd1 = GetSelectedPersistentType(true);
            PersistentTypeItem persistentTypeEnd2 = GetSelectedPersistentType(false);

            AssociationOnRemoveAction onOwnerRemoveActionEnd1 = GetSelectedOnRemoveAction(true, true);
            AssociationOnRemoveAction onOwnerRemoveActionEnd2 = GetSelectedOnRemoveAction(false, true);

            AssociationOnRemoveAction onTargetRemoveActionEnd1 = GetSelectedOnRemoveAction(true, false);
            AssociationOnRemoveAction onTargetRemoveActionEnd2 = GetSelectedOnRemoveAction(false, false);

            MultiplicityKind multiplicityEnd1 = GetSelectedMultiplicity(true);
            MultiplicityKind multiplicityEnd2 = GetSelectedMultiplicity(false);

            string navigationPropertyEnd1 = edNavPropertyEnd1.Text;
            string navigationPropertyEnd2 = edNavPropertyEnd2.Text;

            string associationName = edAssociationName.Text;

            return(new ResultData(persistentTypeEnd1, persistentTypeEnd2, multiplicityEnd1, multiplicityEnd2,
                                  navigationPropertyEnd1, navigationPropertyEnd2, associationName,
                                  onOwnerRemoveActionEnd1, onOwnerRemoveActionEnd2, onTargetRemoveActionEnd1, onTargetRemoveActionEnd2,
                                  chCreateEnd1.Checked, chCreateEnd2.Checked, chUseAssocEnd1.Checked, chUseAssocEnd2.Checked));
        }
예제 #4
0
 public ResultData(PersistentTypeItem persistentTypeEnd1, PersistentTypeItem persistentTypeEnd2,
                   MultiplicityKind multiplicityEnd1, MultiplicityKind multiplicityEnd2, string navigationPropertyEnd1,
                   string navigationPropertyEnd2, string associationName,
                   AssociationOnRemoveAction onOwnerRemoveEnd1, AssociationOnRemoveAction onOwnerRemoveEnd2,
                   AssociationOnRemoveAction onTargetRemoveEnd1, AssociationOnRemoveAction onTargetRemoveEnd2,
                   bool createPropertyEnd1, bool createPropertyEnd2,
                   bool useAssociationAttributeEnd1, bool useAssociationAttributeEnd2)
 {
     PersistentTypeEnd1               = persistentTypeEnd1;
     PersistentTypeEnd2               = persistentTypeEnd2;
     MultiplicityEnd1                 = multiplicityEnd1;
     MultiplicityEnd2                 = multiplicityEnd2;
     NavigationPropertyEnd1           = navigationPropertyEnd1;
     NavigationPropertyEnd2           = navigationPropertyEnd2;
     AssociationName                  = associationName;
     this.OnOwnerRemoveEnd1           = onOwnerRemoveEnd1;
     this.OnOwnerRemoveEnd2           = onOwnerRemoveEnd2;
     this.OnTargetRemoveEnd1          = onTargetRemoveEnd1;
     this.OnTargetRemoveEnd2          = onTargetRemoveEnd2;
     this.CreatePropertyEnd1          = createPropertyEnd1;
     this.CreatePropertyEnd2          = createPropertyEnd2;
     this.UseAssociationAttributeEnd1 = useAssociationAttributeEnd1;
     this.UseAssociationAttributeEnd2 = useAssociationAttributeEnd2;
 }
예제 #5
0
 public static string BuildXtensiveType(AssociationOnRemoveAction enumValue)
 {
     return(BuildXtensiveType(OrmNamespace.Orm, ENUM_TYPE_ON_REMOVE_ACTION, enumValue));
 }