public AttributeTemplate(AttributeDomain attribute, IDataType dataType)
 {
     Name      = attribute.Name;
     Length    = attribute.Length;
     AllowNull = attribute.AllowNull;
     DataType  = dataType;
 }
Exemple #2
0
        public void AttributeIdentifier()
        {
            var attribute     = new AttributeDomain(new Name("Id"), EnumDataTypes.Identifier);
            var notifications = new NotificationManager();

            var valid = attribute.IsValid(notifications);

            Assert.True(valid);
        }
Exemple #3
0
        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());
        }
Exemple #4
0
        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());
        }
Exemple #5
0
        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);
        }
Exemple #6
0
        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();
        }
Exemple #7
0
        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);
        }