Пример #1
0
        public void CreateTable()
        {
            if (mDbMgr.TableExists(mTablename))
            {
                return;
            }

            DbGenerateTableStatement clause = mDbMgr.CreateGenerateTableClause();

            clause
            .CreateTable(mTablename)
            .WithPrimaryKey(mPrimaryKey);

            foreach (string fieldname in mFields.Keys)
            {
                clause.WithField(fieldname, mFields[fieldname]);
            }

            foreach (string fieldname in mForeignKeys.Keys)
            {
                clause.WithReference(fieldname, mForeignKeys[fieldname]);
            }

            mDbMgr.ExecuteNonQuery(clause);
        }
Пример #2
0
        protected virtual DbGenerateTableStatement BuildClause()
        {
            DbGenerateTableStatement clause = mDbMgr.CreateGenerateTableClause();

            clause
            .CreateTable(mTablename)
            .WithPrimaryKey(mPrimaryKey);

            foreach (string fieldname in mFields.Keys)
            {
                clause.WithField(fieldname, mFields[fieldname]);
            }

            foreach (string fieldname in mForeignKeys.Keys)
            {
                clause.WithReference(fieldname, mForeignKeys[fieldname]);
            }

            return(clause);
        }