/// <summary>
        /// Gets the default capacity range selector for the given multiplicity.
        /// </summary>
        /// <param name="multiplicity">The multiplicity.</param>
        /// <returns>Capacity range selector for the given multiplicity.</returns>
        public static Func<CapacityRange> GetDefaultCapacityRangeSelector(EndMultiplicity multiplicity)
        {
            switch (multiplicity)
            {
                case EndMultiplicity.One:
                    return () => CapacityRange.ExactlyOne;

                case EndMultiplicity.ZeroOne:
                    {
                        CapacityRangeSelector selector = new CapacityRangeSelector(interestingCapacitiesForOptionalReference);
                        return () => selector.GetNextCapacity();
                    }

                case EndMultiplicity.Many:
                    {
                        CapacityRangeSelector selector = new CapacityRangeSelector(interestingCapacitiesForCollection);
                        return () => selector.GetNextCapacity();
                    }

                default:
                    throw new TaupoInvalidOperationException("Unhandled multiplicity : " + multiplicity);
            }
        }
Esempio n. 2
0
 /// <summary>
 /// Initializes a new instance of the AssociationEnd class with a given RoleName, EntityType, and multiplicity
 /// </summary>
 /// <param name="roleName">The RoleName for the association end</param>
 /// <param name="type">The EntityType this association end refers to</param>
 /// <param name="multiplicity">Mulitipliciy of this association end</param>
 public AssociationEnd(string roleName, EntityType type, EndMultiplicity multiplicity)
     : this(roleName)
 {
     this.EntityType   = type;
     this.Multiplicity = multiplicity;
 }
Esempio n. 3
0
 /// <summary>
 /// Initializes a new instance of the AssociationEnd class with a given RoleName, EntityType, multiplicity and OnDeleteAction
 /// </summary>
 /// <param name="roleName">The RoleName for the association end</param>
 /// <param name="type">The EntityType this association end refers to</param>
 /// <param name="multiplicity">Mulitipliciy of this association end</param>
 /// <param name="onDeleteAction">OnDelete value</param>
 public AssociationEnd(string roleName, EntityType type, EndMultiplicity multiplicity, OperationAction onDeleteAction)
     : this(roleName, type, multiplicity)
 {
     this.DeleteBehavior = onDeleteAction;
 }
Esempio n. 4
0
 /// <summary>
 /// Initializes a new instance of the AssociationEnd class with a given RoleName, EntityType, and multiplicity
 /// </summary>
 /// <param name="roleName">The RoleName for the association end</param>
 /// <param name="type">The EntityType this association end refers to</param>
 /// <param name="multiplicity">Mulitipliciy of this association end</param>
 public AssociationEnd(string roleName, EntityType type, EndMultiplicity multiplicity)
     : this(roleName)
 {
     this.EntityType = type;
     this.Multiplicity = multiplicity;
 }
 private string GetMultiplicityString(EndMultiplicity endMultiplicity)
 {
     switch (endMultiplicity)
     {
         case EndMultiplicity.Many:
             return "*";
         case EndMultiplicity.One:
             return "1";
         case EndMultiplicity.ZeroOne:
             return "0..1";
         default:
             throw new TaupoNotSupportedException("End multiplicity: " + endMultiplicity + " is not supported by current implementation.");
     }
 }