这里很奇怪。我不太确定生成最小的代码示例需要走多远。
我有以下代码:
public class TruckService : ViperService<Truck, TruckViewModel>, ITruckService
{
public override async Task<Truck> Insert(Truck entity)
{
var viperInsert = await base.Insert(entity);
//Then does other logic
}
}
但是执行此代码时,它会在基类上调用Update方法吗?
public abstract class ViperService<T, TVM> : IViperService<T, TVM> where T : ViperEntity where TVM : ViperViewModel
{
public virtual Task<T> Insert(T entity)
{
return this.viperRepository.Insert(entity);
}
public virtual Task<T> Update(T entity)
{
return this.viperRepository.Update(entity);
}
}
为什么会这样?