Codit / practical-api-guidelines

Practical guidelines for building & designing APIs with .NET.
MIT License
16 stars 5 forks source link

The `TDto` represents a model that is exposed by the API. I wouldn't use that as a parameter in the repository. #93

Closed MassimoC closed 5 years ago

MassimoC commented 5 years ago

The TDto represents a model that is exposed by the API. I wouldn't use that as a parameter in the repository. What I would do, is pass in the TEntity in where the properties are already modified.

_Originally posted by @fgheysels

MassimoC commented 5 years ago
        public async Task ApplyPatchAsync<TEntity, TDto>(TEntity entityToUpdate, TDto dto) where TEntity : class
        {
            if (dto == null)
                throw new ArgumentNullException($"{nameof(dto)}", $"{nameof(dto)} cannot be null.");