private void ValidateRelationEntity(Relation_Type entity) { if (entity.ShouldSerializeid()) { throw new ArgumentException("You must not fill in the Relation_Type.id, use the fluent api to construct a proper relation.", "entity"); } if (entity.ShouldSerializeOriginatingObjectID() || entity.ShouldSerializeOriginatingObjectType()) { throw new ArgumentException("You must not fill in the Relation_Type.OriginatingObjectType, use the fluent api to construct a proper relation.", "entity"); } if (entity.ShouldSerializeRelatedObjectID() || entity.ShouldSerializeRelatedObjectType()) { throw new ArgumentException("You must not fill in the Relation_Type.RelatedObjectType, use the fluent api to construct a proper relation.", "entity"); } if (entity.ShouldSerializeRelationRoleCode()) { throw new ArgumentException("You must not fill in the Relation_Type.RelationRoleCode, use the fluent api to construct a proper relation.", "entity"); } if (entity.ShouldSerializeRelationDescription()) { throw new ArgumentException("You must not fill in the Relation_Type.RelationDescription, use the fluent api to construct a proper relation.", "entity"); } }
private void AddRelationEntity(Relation_Type entity) { _buildRelationshipsActions.AddLast(n => { var originatingObject = n.Items.OfType <IRelation>().Single(m => m.id == entity.OriginatingObjectID); OLI_LU_OBJECTTYPE temp = null; if (!_typeToOliLuObjectType.TryGetValue(originatingObject.GetType(), out temp)) { throw new ArgumentException("This argument is not allowed to be related.", "originatingObjectID"); } entity.OriginatingObjectType = temp; if (!string.IsNullOrWhiteSpace(entity.RelatedObjectID)) { var relatedObject = n.Items.OfType <IRelation>().Single(m => m.id == entity.RelatedObjectID); temp = null; if (!_typeToOliLuObjectType.TryGetValue(relatedObject.GetType(), out temp)) { throw new ArgumentException("This argument is not allowed to be related.", "originatingObjectID"); } entity.RelatedObjectType = temp; } n.Items.Add(entity); }); }
public override Sans_BeginRelation_OLifEBuilder BeginRelation(string id) { _buildRelation = new Relation_Type { id = id }; return(this); }
public override Sans_Properties_OLifEBuilder EndRelation(Relation_Type entity, Relation_Type reciprocalEntity) { // Relation var clonedEntity = entity.Clone(); ValidateRelationEntity(clonedEntity); clonedEntity.id = _buildRelation.id; clonedEntity.OriginatingObjectID = _buildRelation.OriginatingObjectID; clonedEntity.RelatedObjectID = _buildRelation.RelatedObjectID; clonedEntity.RelationRoleCode = _buildRelation.RelationRoleCode; clonedEntity.RelationDescription = _buildRelation.RelationDescription; AddRelationEntity(clonedEntity); _buildRelation = null; // Reciprocal Relation var clonedReciprocalEntity = reciprocalEntity.Clone(); ValidateRelationEntity(clonedReciprocalEntity); clonedReciprocalEntity.id = _buildReciprocalRelation.id; clonedReciprocalEntity.OriginatingObjectID = _buildReciprocalRelation.OriginatingObjectID; clonedReciprocalEntity.RelatedObjectID = _buildReciprocalRelation.RelatedObjectID; clonedReciprocalEntity.RelationRoleCode = _buildReciprocalRelation.RelationRoleCode; clonedReciprocalEntity.RelationDescription = _buildReciprocalRelation.RelationDescription; AddRelationEntity(clonedReciprocalEntity); _buildReciprocalRelation = null; return(this); }
public override Sans_Relation_Where_IsA_Of_AndReciprocal_OLifEBuilder AndReciprocal(string id, OLI_LU_REL relationRoleCode) { _buildReciprocalRelation = new Relation_Type { id = id, RelationRoleCode = relationRoleCode.Clone(), RelatedObjectID = _buildRelation.OriginatingObjectID, OriginatingObjectID = _buildRelation.RelatedObjectID, }; return(this); }
private void SetAll(Entity first, Entity second, Relation_Type type, Relation_Type mandatory, string name) { First_Entity = first; Second_Entity = second; Relation_type = new Relation_Type[2] { type, mandatory }; Attributes = new List <Attribute>(); rule = SetRule(); Name = name; }
public override Sans_Properties_OLifEBuilder EndRelation() { AddRelationEntity(_buildRelation.Clone()); if (_buildReciprocalRelation != null) { AddRelationEntity(_buildReciprocalRelation.Clone()); } _buildRelation = null; _buildReciprocalRelation = null; return(this); }
internal static IEnumerable<string> Relation(Relation_Type relation, string module) { List<string> errors = new List<string>(); if (relation == null) { errors.Add(module + " relation"); } else { if (string.IsNullOrWhiteSpace(relation.id)) { errors.Add (module + " relation id"); } if (string.IsNullOrWhiteSpace(relation.OriginatingObjectID)) { errors.Add(module + " relation OriginatingObjectID"); } if (LUObjNotValid(relation.OriginatingObjectType)) { errors.Add(module + " relation OriginatingObjectType"); } if (string.IsNullOrWhiteSpace(relation.RelatedObjectID)) { errors.Add(module + " relation RelatedObjectID"); } if (LUObjNotValid(relation.RelatedObjectType)) { errors.Add(module + " relation RelatedObjectType"); } if (LUObjNotValid(relation.RelationRoleCode)) { errors.Add(module + " relation RelationRoleCode"); } } return errors; }
public abstract Sans_Properties_OLifEBuilder EndRelation(Relation_Type entity, Relation_Type reciprocalEntity);
public abstract Sans_Properties_OLifEBuilder AddRelation(Relation_Type entity);
public override Sans_Properties_OLifEBuilder AddRelation(Relation_Type entity) { AddItem(entity); return(this); }
public Relation(Entity first, Entity second, Relation_Type type, Relation_Type mandatory, string name, string info) { SetAll(first, second, type, mandatory, name); Additional = info; }
public Relation(Entity first, Entity second, Relation_Type type, Relation_Type mandatory, string name) { SetAll(first, second, type, mandatory, name); }