自动导航插入在实体中没有配置导航属性时报错 返回

SqlSugar 处理中
1 459
该叫什么 发布于2024/2/6
悬赏:0 飞吻
using SqlSugar;

SqlSugarScope db;

db = new SqlSugarScope(new ConnectionConfig()
{
    ConnectionString = "PORT=5432;DATABASE=;HOST=;PASSWORD=;USER ID=",
    DbType = DbType.PostgreSQL,
    IsAutoCloseConnection = true,

});

//建表 
if (!db.DbMaintenance.IsAnyTable("TestEntity", false))
{
    db.CodeFirst.InitTables<TestEntity>();
}


TestEntity entity = new()
{
    no = "1",
    name = "2"
};

await db.InsertNav(entity).IncludesAllFirstLayer().ExecuteCommandAsync();

class TestEntity
{
    public string no { get; set; }
    public string name { get; set; }
};

报错信息: System.ArgumentOutOfRangeException:“Index was out of range. Must be non-negative and less than the size of the collection

热忱回答1

  • 这个我后面优化一下,目前只能用于导航表

    0 回复