コード例 #1
0
        internal void Add(RdbColumn column)
        {
            if (column.Info.IsIdentity)
            {
                if (_identityColumn != null)
                {
                    throw new ORMException(string.Format(
                                               "cannot add idenity column {0} to table {1}, it already has an identity column {2}",
                                               column.Name, this.Name, _identityColumn.Name));
                }
                _identityColumn = column;
            }

            if (column.Info.IsPrimaryKey)
            {
                if (_pkColumn != null)
                {
                    throw new ORMException(string.Format(
                                               "cannot add primary key column {0} to table {1}, it already has an primary key column {2}",
                                               column.Name, this.Name, _pkColumn.Name));
                }

                _pkColumn = column;
            }

            if (column.IsLOB)
            {
                _hasLOB = true;
            }

            _columns.Add(column);
        }
コード例 #2
0
ファイル: RdbTable.cs プロジェクト: zhuwansu/Rafy
        /// <summary>
        /// 把属性名转换为列名
        /// </summary>
        /// <param name="propertyName"></param>
        /// <returns></returns>
        internal string Translate(string propertyName)
        {
            string name = null;

            RdbColumn column = FindByPropertyName(propertyName);
            if (column != null) { name = column.Name; }

            if (string.IsNullOrEmpty(name))
            {
                throw new ORMException(string.Format("表 {1} 中没有找到对应的列:{0}。", propertyName, this.Name));
            }

            return name;
        }
コード例 #3
0
ファイル: RdbTable.cs プロジェクト: hardCTE/Rafy
        internal void Add(RdbColumn column)
        {
            if (column.Info.IsIdentity)
            {
                if (_identityColumn != null)
                {
                    throw new ORMException(string.Format(
                        "cannot add idenity column {0} to table {1}, it already has an identity column {2}",
                        column.Name, this.Name, _identityColumn.Name));
                }
                _identityColumn = column;
            }

            if (column.Info.IsPrimaryKey)
            {
                if (_pkColumn != null)
                {
                    throw new ORMException(string.Format(
                        "cannot add primary key column {0} to table {1}, it already has an primary key column {2}",
                        column.Name, this.Name, _pkColumn.Name));
                }

                _pkColumn = column;
            }

            if (column.IsLOB)
            {
                _hasLOB = true;
            }

            _columns.Add(column);
        }
コード例 #4
0
 protected virtual bool CanInsert(RdbColumn column)
 {
     //Sql Server 中的 Identity 列是不需要插入的。
     return(!column.Info.IsIdentity);
 }
コード例 #5
0
ファイル: RdbTable.cs プロジェクト: 569550384/Rafy
 protected virtual bool CanInsert(RdbColumn column)
 {
     //Sql Server 中的 Identity 列是不需要插入的。
     return !column.Info.IsIdentity;
 }