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

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

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

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

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