Ejemplo n.º 1
0
        /// <summary>
        /// Execute a Update.
        /// </summary>
        /// <returns></returns>
        /// <exception cref="AttributeNotFoundException">Class attribute parameter 'Mutable' must be seted to 'true'</exception>
        public virtual bool Update()
        {
            ActiveRecordAttribute attribute = null;

            CheckTypeAtrribute(this.GetType(), ref attribute);

            if (!attribute.Mutable)
            {
                throw new AttributeNotFoundException("Class attribute parameter 'Mutable' must be seted to 'true'");
            }

            //Cascade Update
            if (ActiveRecordMaster.HasJoinedBase(this.GetType()) != null)
            {
                if (ActiveRecordMaster.GetAttribute(this.GetType().BaseType) != null)
                {
                    if (!ActiveRecordMaster.Update(this.GetType().BaseType, this))
                    {
                        return(false);
                    }
                }
            }

            return(ActiveRecordMaster.Update(this.GetType(), this));
        }