public AttributeTemplate(AttributeDomain attribute, IDataType dataType) { Name = attribute.Name; Length = attribute.Length; AllowNull = attribute.AllowNull; DataType = dataType; }
public void AttributeIdentifier() { var attribute = new AttributeDomain(new Name("Id"), EnumDataTypes.Identifier); var notifications = new NotificationManager(); var valid = attribute.IsValid(notifications); Assert.True(valid); }
public void AttributeStringWithoutLength() { var attribute = new AttributeDomain(new Name("Name"), EnumDataTypes.String); var notifications = new NotificationManager(); var valid = attribute.IsValid(notifications); Assert.False(valid); Assert.Contains(nameof(AttributeDomain.Length), notifications.ToPropertiesNameList()); }
public void AttributeInvalidDataType() { var attribute = new AttributeDomain(new Name("Name"), EnumDataTypes.Null); var notifications = new NotificationManager(); var valid = attribute.IsValid(notifications); Assert.False(valid); Assert.Contains(nameof(AttributeDomain.DataType), notifications.ToPropertiesNameList()); }
public void AttributeStringWithLength() { var attribute = new AttributeDomain( new Name("Name"), EnumDataTypes.String, true, 64 ); var notifications = new NotificationManager(); var valid = attribute.IsValid(notifications); Assert.True(valid); }
public static void AddAttribute(AttributeDomain mAttribute) { string mainconn = ConfigurationManager.ConnectionStrings["conn"].ConnectionString; SqlConnection sqlconn = new SqlConnection(mainconn); SqlCommand cmd = new SqlCommand("sp_Attribute", sqlconn); cmd.CommandType = System.Data.CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@mode", "PostAttribute"); cmd.Parameters.AddWithValue("@AttributeName", mAttribute.AttributeName); cmd.ExecuteNonQuery(); }
private EntityDomain CreateEntityDomain(string entityName, bool addElement) { var entityDomain = new EntityDomain(new Name(entityName)); var attributeDomain = new AttributeDomain( new Name("Id"), EnumDataTypes.String, false, 32 ); entityDomain.AddAttribute(attributeDomain); if (addElement) { var entityElementDomain = CreateEntityDomain("ElementChild", false); var element = new ElementDomain(entityElementDomain, EnumDataTypes.Object); entityDomain.AddElement(element); } return(entityDomain); }