ffernandolima / ef-core-data-access

It's a modern and generic data access structure for .NET and Microsoft.EntityFrameworkCore. It supports UnitOfWork, Repository and QueryBuilder patterns. It also includes auto history utilities, multiple databases support with distributed transactions and databases/tables sharding for some database providers.
MIT License
165 stars 25 forks source link

[Feature Request] ```Task<T> UpdateAsync()``` method #16

Closed nausixkiz closed 1 year ago

nausixkiz commented 1 year ago

Example:

...
public void UpdateBlog()
{
    var repository = _unitOfWork.Repository<Blog>();

    var blog = await repository.UpdateAsync(model); ///Not work

    _unitOfWork.SaveChangesAsync();
}
...

Look like IAsyncRepository<T> in EntityFrameworkCore.Repository.Interfaces doesn't have method below:

 Task<T> UpdateAsync(
      T entity, 
      params Expression<Func<T, object>>[] properties
      CancellationToken cancellationToken = default (CancellationToken));
ffernandolima commented 1 year ago

Hi!

There isn't this method because EF Core doesn't support it.

Please see this issue for more info.

nausixkiz commented 1 year ago

Thank @ffernandolima, Does this mean we have to remove the old record and add a new one when we want using async?

ffernandolima commented 1 year ago

@nausixkiz you can simply use the sync method. It'd be fine.