Exemplo n.º 1
0
        public override void FromXml(XElement xmlAttribute)
        {
            if (xmlAttribute.HasAttributes)
            {
                this.Name = xmlAttribute.Attribute("name") != null?xmlAttribute.Attribute("name").Value : string.Empty;

                this.IsDefault = xmlAttribute.Attribute("isDefault") != null?bool.Parse(xmlAttribute.Attribute("isDefault").Value.ToString()) : false;

                this.AttributeType = EntityAttributeModel.GetValidAttributeTypeFromString(xmlAttribute.Attribute("attributeType").Value.Replace(" ", ""));
                this.AllowForMap   = xmlAttribute.Attribute("allowForMap") != null?bool.Parse(xmlAttribute.Attribute("allowForMap").Value.ToString()) : false;

                if (this.AllowForMap.Value)
                {
                    this.MapAlias = xmlAttribute.Attribute("mapAlias") != null?xmlAttribute.Attribute("mapAlias").Value : string.Empty;
                }

                switch (this.AttributeType)
                {
                case AttributeType.Integer16:
                case AttributeType.Integer32:
                case AttributeType.Integer64:
                    this.AttributeInfo = new AttributeInfoInteger(xmlAttribute);
                    break;

                case AttributeType.String:
                    this.AttributeInfo = new AttributeInfoString(xmlAttribute);
                    break;

                case AttributeType.Double:
                    this.AttributeInfo = new AttributeInfoDouble(xmlAttribute);
                    break;

                case AttributeType.Date:
                    this.AttributeInfo = new AttributeInfoDate(xmlAttribute);
                    break;

                default:
                    this.AttributeInfo = new AttributeInfo(xmlAttribute);
                    break;
                }
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// Deletes the attribute.
 /// </summary>
 /// <param name="attribute">The attribute.</param>
 public void DeleteAttribute(EntityAttributeModel attribute)
 {
     this.Attributes.Remove(attribute);
     this.DeletedAttributes.Add(attribute);
 }