Exemple #1
0
        internal Index(Entity owner, XmlNode indexNode)
            : base(owner, indexNode)
        {
            this.columns = new IndexColumns(this);
            if (Utils.Xml.IsAttrExists(indexNode, "name"))
            {
                this.name = Utils.Xml.GetAttrValue(indexNode, "name");
                LockName();
            }
            this.schema = owner.Persistence.Schema;
            this.unique = Utils.Xml.GetAttrValue(indexNode, "unique", this.unique);
            foreach (XmlNode node in indexNode.ChildNodes)
            {
                if (node.Name == "OnAttribute")
                {
                    string    attrName = Utils.Xml.GetAttrValue(node, "name");
                    Attribute a        = owner.Attributes.GetByName(attrName);
                    if (a == null)
                    {
                        throw new GlException("Index attribute '{0}' not found. Entity: {1}", attrName, owner.FullName);
                    }

                    IndexColumn col = new IndexColumn(this)
                    {
                        Attribute = a,
                        Order     = IndexColumn.ParseOrder(Utils.Xml.GetAttrValue(node, "order"))
                    };
                    this.columns.Add(col);
                }
            }
        }
Exemple #2
0
 public Index(Entity owner)
     : base(owner, owner.Persistence.Schema, Const.EmptyName)
 {
     this.columns = new IndexColumns(this);
 }