/// <summary> /// Adds a property assignment containing the new id value if there is non yet in the array. /// </summary> /// <returns>Element property assignments containing an id property assignment.</returns> public virtual DslModeling::PropertyAssignment[] CreateId() { DslModeling::PropertyAssignment[] propertyAssignmentsWithKey = new DslModeling::PropertyAssignment[1]; propertyAssignmentsWithKey[0] = new DslModeling::PropertyAssignment(DslModeling::ElementFactory.IdPropertyAssignment, GenerateNewKey()); return(propertyAssignmentsWithKey); }
/// <summary> /// Adds a property assignment containing the new id value if there is non yet in the array. /// </summary> /// <param name="propertyAssignments">Element property assignments.</param> /// <returns>Element property assignments containing an id property assignment.</returns> public virtual DslModeling::PropertyAssignment[] AssignId(DslModeling::PropertyAssignment[] propertyAssignments) { bool bHasKey = false; if (propertyAssignments != null) { foreach (DslModeling::PropertyAssignment p in propertyAssignments) { if (p.PropertyId == DslModeling::ElementFactory.IdPropertyAssignment) { bHasKey = true; break; } } } if (!bHasKey) { int length = 1; if (propertyAssignments != null) { length += propertyAssignments.Length; } DslModeling::PropertyAssignment[] propertyAssignmentsWithKey = new DslModeling::PropertyAssignment[length]; propertyAssignmentsWithKey[length - 1] = new DslModeling::PropertyAssignment(DslModeling::ElementFactory.IdPropertyAssignment, GenerateNewKey()); if (propertyAssignments != null) { for (int i = 0; i < propertyAssignments.Length; ++i) { propertyAssignmentsWithKey[i] = propertyAssignments[i]; } } return(propertyAssignmentsWithKey); } else { return(propertyAssignments); } }
/// <summary> /// Adds a property assignment containing the new id value if there is non yet in the array. /// </summary> /// <returns>Element property assignments containing an id property assignment.</returns> public virtual DslModeling::PropertyAssignment[] CreateId() { DslModeling::PropertyAssignment[] propertyAssignmentsWithKey = new DslModeling::PropertyAssignment[1]; propertyAssignmentsWithKey[0] = new DslModeling::PropertyAssignment(DslModeling::ElementFactory.IdPropertyAssignment, GenerateNewKey()); return propertyAssignmentsWithKey; }
/// <summary> /// Adds a property assignment containing the new id value if there is non yet in the array. /// </summary> /// <param name="propertyAssignments">Element property assignments.</param> /// <returns>Element property assignments containing an id property assignment.</returns> public virtual DslModeling::PropertyAssignment[] AssignId(DslModeling::PropertyAssignment[] propertyAssignments) { bool bHasKey = false; if (propertyAssignments != null) foreach (DslModeling::PropertyAssignment p in propertyAssignments) if (p.PropertyId == DslModeling::ElementFactory.IdPropertyAssignment) { bHasKey = true; break; } if (!bHasKey) { int length = 1; if (propertyAssignments != null) length += propertyAssignments.Length; DslModeling::PropertyAssignment[] propertyAssignmentsWithKey = new DslModeling::PropertyAssignment[length]; propertyAssignmentsWithKey[length-1] = new DslModeling::PropertyAssignment(DslModeling::ElementFactory.IdPropertyAssignment, GenerateNewKey()); if (propertyAssignments != null) for (int i = 0; i < propertyAssignments.Length; ++i) propertyAssignmentsWithKey[i] = propertyAssignments[i]; return propertyAssignmentsWithKey; } else return propertyAssignments; }