public PropertyPredefinition ToPropertyPredefinition() { var property = new PropertyPredefinition(this.AttributeName, this.AttributeType); //Todo insert attribute type property.SetAttributeType(this.AttributeType != null ? this.AttributeType : null); property.SetComment(this.Comment != null ? this.Comment : null); if (this.IsIndexed) { property.SetAsIndexed(); } if (this.IsMandatory) { property.SetAsMandatory(); } if (this.IsUnique) { property.SetAsUnique(); } if (this.DefaultValue != null) { property.SetDefaultValue(this.DefaultValue); } if (this.Multiplicity.Equals(ServicePropertyMultiplicity.List)) { property.SetMultiplicityToList(); } if (this.Multiplicity.Equals(ServicePropertyMultiplicity.Set)) { property.SetMultiplicityToSet(); } return(property); }
/// <summary> /// Converts the unknown properties into properties / edges. /// </summary> /// <param name="myUnknown">The unknown property predefinition.</param> /// <returns>The property predefinition.</returns> protected static PropertyPredefinition ConvertUnknownToProperty(UnknownAttributePredefinition myUnknown) { if (myUnknown.EdgeType != null) { throw new Exception("An edge type is not allowed on a property."); } var prop = new PropertyPredefinition(myUnknown.AttributeName, myUnknown.AttributeType) .SetDefaultValue(myUnknown.DefaultValue) .SetComment(myUnknown.Comment); if (myUnknown.IsUnique) { prop.SetAsUnique(); } if (myUnknown.IsMandatory) { prop.SetAsMandatory(); } if (myUnknown.Multiplicity != null) { switch (myUnknown.Multiplicity) { case UnknownAttributePredefinition.LISTMultiplicity: prop.SetMultiplicityToList(); break; case UnknownAttributePredefinition.SETMultiplicity: prop.SetMultiplicityToSet(); break; default: throw new Exception("Unknown multiplicity for properties."); } } return(prop); }
public PropertyPredefinition ToPropertyPredefinition() { var property = new PropertyPredefinition(this.AttributeName,this.AttributeType); //Todo insert attribute type property.SetAttributeType(this.AttributeType != null ? this.AttributeType : null); property.SetComment(this.Comment != null ? this.Comment : null); if (this.IsIndexed) property.SetAsIndexed(); if (this.IsMandatory) property.SetAsMandatory(); if (this.IsUnique) property.SetAsUnique(); if (this.DefaultValue != null) property.SetDefaultValue(this.DefaultValue); if (this.Multiplicity.Equals(ServicePropertyMultiplicity.List)) property.SetMultiplicityToList(); if (this.Multiplicity.Equals(ServicePropertyMultiplicity.Set)) property.SetMultiplicityToSet(); return property; }
private static PropertyPredefinition ConvertUnknownToProperty(UnknownAttributePredefinition unknown) { if (unknown.EdgeType != null) throw new Exception("An edge type is not allowed on a property."); var prop = new PropertyPredefinition(unknown.AttributeName) .SetDefaultValue(unknown.DefaultValue) .SetAttributeType(unknown.AttributeType) .SetComment(unknown.Comment); if (unknown.IsUnique) prop.SetAsUnique(); if (unknown.IsMandatory) prop.SetAsMandatory(); if (unknown.Multiplicity != null) switch (unknown.Multiplicity) { case UnknownAttributePredefinition.LISTMultiplicity: prop.SetMultiplicityToList(); break; case UnknownAttributePredefinition.SETMultiplicity: prop.SetMultiplicityToSet(); break; default: throw new Exception("Unknown multiplicity for properties."); } return prop; }