Skip to content

当实体只配置了一个自增主键时,插入数据报错 #1326

@hd2y

Description

@hd2y

问题描述及重现步骤:

创建一个仅包含自增主键的实体 TestEntity

public class TestEntity
{
    [Column(IsIdentity = true, IsPrimary = true)]
    public int Id { get; set; }
}

执行新增操作:

freeSql.Insert(new TestEntity {}).ExecuteAffrows();

输出SQL为:

INSERT INTO "TestEntity"() VALUES()
--SQLite error (1): near ")": syntax error in "INSERT INTO "TestEntity"() VALUES()"

期望输出的SQL应该是:

INSERT INTO "TestEntity" DEFAULT VALUES;

数据库的具体版本

SQLite with "Data Source=:memory:"

安装的包

FreeSql.All 3.2.682

.net framework/. net core? 及具体版本

.net 7.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions