实体框架核心更新一对多无法更新列表

时间:2019-06-05 04:29:50

标签: entity-framework .net-core entity-framework-core

public class TpmProjectEditDto : : FullAuditedEntity<long?, User>
{
    public string Name { get; set; }

    public ICollection<TpmProjectContactLinkDto> TpmProjectContactLink { get; set; }
    public ICollection<TpmProjectClassLinkDto> TpmProjectClassLink { get; set; }
}


protected virtual async Task Update(TpmProjectEditDto input)
{
    var entity = await _entityRepository.GetAllIncluding(t=>t.TpmProjectContactLink,t=>t.TpmProjectClassLink,t => t.TpmProjectErrorLink).Where(t => t.Id == input.Id).SingleOrDefaultAsync();
    ObjectMapper.Map(input, entity);
    await _entityRepository.UpdateAsync(entity);
}

TpmProjectContactLinkTpmProjectClassLink无法更新-如何修改代码实现一对多更新?

0 个答案:

没有答案