净核心排除列更新或插入

时间:2019-12-09 09:05:14

标签: c# postgresql entity-framework-core

我有一个带有BarCode列的客户表,该条形码由Postgres数据库自动生成。因此,在我的更新或插入内容中,我想排除该列,由于某种原因,他抛出了错误git ls-files --recurse-submodules -z | tar --null -T - -czvf output.tar.gz # git ls-files # --recurse-submocules # -z, split output lines with null # tar # -T -, read files from stdin

模型类:

Microsoft.EntityFrameworkCore.DbUpdateConcurrencyException

Linq更新

public class CustomersModel
{
    public Guid Customer_id { get; set; }
    public string FirstName { get; set; }
    public string MaidenName { get; set; }
    public string LastName { get; set; }
    public DateTime? BirthDate { get; set; }
    public Guid Title { get; set; }
    public Guid Language_id { get; set; }
    public string SSN { get; set; }
    public Boolean Active { get; set; }
    public int BarCode { get; set; }

}

Postgres表

context.Customers.UpdateRange(Customer);
context.UpdateRange(Customer);
context.Entry<CustomersModel>(Customer).Property(x => x.BarCode).IsModified = false;
context.SaveChanges();

建议?

理查德

0 个答案:

没有答案