コード例 #1
0
ファイル: Dao.cs プロジェクト: ThreeHeadz/Bam.Net
        public void Insert(Database db = null)
        {
            db = db ?? Database;
            ThrowIfInvalid();
            QuerySet querySet = GetQuerySet(db);

            WriteInsert(querySet);
            if (!string.IsNullOrWhiteSpace(querySet.ToString()))
            {
                ExecuteCommit(db, querySet);
            }
        }
コード例 #2
0
ファイル: Dao.cs プロジェクト: ThreeHeadz/Bam.Net
        /// <summary>
        /// Save the current instance.  If the Id is less than or
        /// equal to 0 the current instance will be Inserted, otherwise
        /// it will be Updated.  Will also commit any updates to its
        /// children, though child commit events will be triggerred the
        /// children should be re-hydrated to ensure they are fully
        /// hydrated.
        /// Same as Save
        /// </summary>
        public void Commit(Database db, bool commitChildren)
        {
            db = db ?? Database;

            ThrowIfInvalid();

            QuerySet querySet = GetQuerySet(db);

            WriteCommit(querySet, db);
            if (commitChildren)
            {
                WriteChildCommits(querySet, db);
            }

            if (!string.IsNullOrWhiteSpace(querySet.ToString()))
            {
                ExecuteCommit(db, querySet);
            }
        }