public EntityBatchRelationship AssociateParent(string parentUniqueRelationshipName, RecordKeyType linkOn, List <string> childFieldNamesToMatchOn) { var relationship = new EntityBatchRelationship("ParentRel_" + Guid.NewGuid().ToString(), parentUniqueRelationshipName, linkOn, childFieldNamesToMatchOn); AssociateParent(relationship); return(relationship); }
public void AddAutoBindingForeignKey(string foreignKeyFieldToUpdate, int parentPrimaryKeyColumnIdx, string parentUniqueRelationshipName, RecordKeyType linkOn, List <string> childFieldNamesToMatchOn) { if (String.IsNullOrWhiteSpace(foreignKeyFieldToUpdate)) { throw new Exception("Foreign key field to update is missing or empty."); } var foreignKeyRelationship = new EntityBatchRelationship("AutoBindingForeignKey_" + Guid.NewGuid().ToString(), parentUniqueRelationshipName, linkOn, childFieldNamesToMatchOn); AssociateParent(foreignKeyRelationship); AutoBindingForeignKeys.Add(new AutoBindingForeignKey(foreignKeyRelationship, foreignKeyFieldToUpdate, parentPrimaryKeyColumnIdx)); }
public AutoBindingForeignKey(EntityBatchRelationship relationship, string fieldNameToUpdate, int parentPrimaryKeyColumnIdx) { if (relationship == null) { throw new Exception("Foreign key relationship can not be null"); } if (String.IsNullOrWhiteSpace(fieldNameToUpdate)) { throw new Exception("Field name to update is missing or empty."); } Relationship = relationship; FieldNameToUpdate = fieldNameToUpdate; ParentPrimaryKeyColumnIdx = parentPrimaryKeyColumnIdx; }
public void AssociateParent(EntityBatchRelationship relationship) { if (relationship == null) { throw new Exception("Relationship can not be null."); } if (Relationships.ContainsKey(relationship.Name)) { throw new Exception(string.Format("A relationship with name '{0}' already exists.", relationship.Name)); } Relationships.Add(relationship.Name, relationship); foreach (var childFieldName in relationship.ChildFieldNamesToMatchOn) { DataOnlyFields.Add(new DataOnlyField(childFieldName, isRequiredByJobBatch: false)); } }