We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Table(Name = "CodeFirstEntity")] public class CodeFirstEntity { [Column(Name = "id", IsPrimary = true)] public long Id { get; set; } [Column(Name = "identity", IsIdentity = true, CanInsert = false)] public long Identity { get; set; } [Column(Name = "str_name", StringLength = 20, IsNullable = false)] public string str_name { get; set; } = string.Empty; } var entity = new CodeFirstEntity { Id = 1, str_name = "name" }; var sql = fsql.Insert(entity) .IgnoreColumns(s => s.Identity) .NoneParameter() .OnConflictDoUpdate() .DoNothing() .ToSql(); var sql = fsql.Insert(entity) .InsertColumns(s => new { s.Id, s.str_name }) .NoneParameter() .OnConflictDoUpdate(q => q.Id) .DoNothing() .ToSql();
以上两种情况都会生成identity插入,只有删除IsIdentity特性才可以解决,但有时候是需要根据实体自动建表的,这个有办法解决吗?
INSERT INTO CodeFirstEntity(id, identity, str_name) VALUES(1, 0, 'name') ON CONFLICT(id) DO NOTHING
忽略此列可否生成如下输出?
INSERT INTO CodeFirstEntity(id, str_name) VALUES(1, 'name') ON CONFLICT(id) DO NOTHING
The text was updated successfully, but these errors were encountered:
是的,自增默认都会插入,可以考虑用一个新实体类型解决
Sorry, something went wrong.
Reference in
ok, thx!
No branches or pull requests
以上两种情况都会生成identity插入,只有删除IsIdentity特性才可以解决,但有时候是需要根据实体自动建表的,这个有办法解决吗?
忽略此列可否生成如下输出?
The text was updated successfully, but these errors were encountered: