コード例 #1
0
ファイル: NPocoMapper.cs プロジェクト: TiandaoStudy/Naif.Data
        public void GetTableInfo(Type t, TableInfo ti)
        {
            //Table Name
            ti.TableName = Util.GetAttributeValue<ComponentModel.TableNameAttribute, string>(t, "TableName", ti.TableName + "s");

            ti.TableName = _tablePrefix + ti.TableName;

            //Primary Key
            ti.PrimaryKey = Util.GetPrimaryKeyName(t.GetTypeInfo());

            ti.AutoIncrement = true;
        }
コード例 #2
0
ファイル: TableInfo.cs プロジェクト: asterd/NPoco.iSeries
        public static TableInfo FromPoco(Type t)
        {
            var tableInfo = new TableInfo();

            // Get the table name
            var a = t.GetCustomAttributes(typeof(TableNameAttribute), true);
            tableInfo.TableName = a.Length == 0 ? t.Name : (a[0] as TableNameAttribute).Value;

            // Get the primary key
            a = t.GetCustomAttributes(typeof(PrimaryKeyAttribute), true);
            tableInfo.PrimaryKey = a.Length == 0 ? "ID" : (a[0] as PrimaryKeyAttribute).Value;
            tableInfo.SequenceName = a.Length == 0 ? null : (a[0] as PrimaryKeyAttribute).SequenceName;
            tableInfo.AutoIncrement = a.Length == 0 ? true : (a[0] as PrimaryKeyAttribute).AutoIncrement;

            // Set autoincrement false if primary key has multiple columns
            tableInfo.AutoIncrement = tableInfo.AutoIncrement ? !tableInfo.PrimaryKey.Contains(',') : tableInfo.AutoIncrement;

            return tableInfo;
        }
コード例 #3
0
ファイル: DefaultMapper.cs プロジェクト: NickJosevski/NPoco
 public virtual void GetTableInfo(Type t, TableInfo ti)
 {
 }
コード例 #4
0
 public virtual void GetTableInfo(Type t, TableInfo ti)
 {
 }