我想使用如下所示的 EF Core 在通用存储库中实现 ADDorUpdate() 方法?谁能帮我?
public virtual void AddOrUpdate(T entity)
{
#region Argument Validation
if (entity == null)
{
throw new ArgumentNullException("entity");
}
#endregion
DbSet.AddOrUpdate(e => e.Id, entity);
this.DbContext.SaveChanges();
}
Run Code Online (Sandbox Code Playgroud) c# generics repository-pattern entity-framework-core asp.net-core