/// <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); } }
/// <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; }
/// <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; }
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."); } }