Exemplo n.º 1
0
 /// <summary>
 /// Called when some attribute is inserted to the list.
 /// </summary>
 /// <param name="entityAttr">The attribute.</param>
 /// <param name="index">The index.</param>
 protected virtual void OnEntityAttrInsertion(MetaEntityAttr entityAttr, int index)
 {
     entityAttr.Entity = _entity;
     if (_entity.Model != null)
     {
         entityAttr.OnModelAssignment();
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// Assigns the default ID for entity attribute.
        /// </summary>
        /// <param name="attr">The EntityAttr object.</param>
        public virtual void AssignEntityAttrID(MetaEntityAttr attr)
        {
            string id = "";

            if (attr.IsVirtual)
            {
                id = "VEA_" + GetNextEntityAttrId().ToString();
            }
            else
            {
                string baseID = attr.Expr.ToIdentifier();
                id = baseID;
                int N = 1;
                while (EntityRoot.FindAttributeById(id) != null)
                {
                    N++;
                    id = baseID + N.ToString();
                }
            }
            attr.Id = id;
        }
Exemplo n.º 3
0
 /// <summary>
 /// Inserts an element into the <see cref="T:System.Collections.ObjectModel.Collection`1"/> at the specified index.
 /// </summary>
 /// <param name="index">The zero-based index at which <paramref name="item"/> should be inserted.</param>
 /// <param name="item">The object to insert. The value can be null for reference types.</param>
 /// <exception cref="T:System.ArgumentOutOfRangeException">
 ///     <paramref name="index"/> is less than zero.
 /// -or-
 /// <paramref name="index"/> is greater than <see cref="P:System.Collections.ObjectModel.Collection`1.Count"/>.
 /// </exception>
 protected override void InsertItem(int index, MetaEntityAttr item)
 {
     base.InsertItem(index, item);
     OnEntityAttrInsertion(item, index);
 }