DotNetNext / SqlSugar

.Net aot ORM Fastest ORM Simple Easy VB.NET Sqlite orm Oracle ORM Mysql Orm 虚谷数据库 postgresql ORm SqlServer oRm 达梦 ORM 人大金仓 ORM 神通ORM C# ORM , C# ORM .NET ORM NET5 ORM .NET6 ORM ClickHouse orm QuestDb ,TDengine ORM,OceanBase orm,GaussDB orm ,Tidb orm Object/Relational Mapping
https://www.donet5.com/Home/Doc
MIT License
5.27k stars 1.33k forks source link

修复pgsql数据库表字段驼峰命名,使用插入返回主键方法时报找不到主键名错误 #1106

Closed wuuer closed 1 year ago

DotNetNext commented 1 year ago

非驼峰你测过吗

DotNetNext commented 1 year ago

image

本地没有重现你说的 找不到主键报错

DotNetNext commented 1 year ago

可以写个DEMO

DotNetNext commented 1 year ago
       db.CodeFirst.InitTables<UpperOrder>();

            var id=db.Insertable(new UpperOrder() { Name = "a", CreateTime = DateTime.Now, CustomId = 1 })
                .ExecuteReturnIdentity();

        public class UpperOrder
        {
            [SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
            public int Id { get; set; }

            public string Name { get; set; }
            public decimal Price { get; set; }
            [SugarColumn(IsNullable = true)]
            public DateTime CreateTime { get; set; }
            [SugarColumn(IsNullable = true)]
            public int CustomId { get; set; }
            [SugarColumn(IsIgnore = true)]
            public List<OrderItem> Items { get; set; }
        }
DotNetNext commented 1 year ago

PgSqlIsAutoToLower = false, PgSqlIsAutoToLowerCodeFirst=false