Skip to content

Commit

Permalink
Add messages to obsolete specs for clarity (#373)
Browse files Browse the repository at this point in the history
* Add messages to obsolete specs for clarity

* Update messages to be more straightforward & concise
  • Loading branch information
Rowe2ryWA authored Sep 14, 2023
1 parent a2698eb commit fab04ee
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -102,14 +102,14 @@ public virtual async Task<T> GetByIdAsync<TId>(TId id, CancellationToken cancell
}

/// <inheritdoc/>
[Obsolete]
[Obsolete("Use FirstOrDefaultAsync<T> or SingleOrDefaultAsync<T> instead. The SingleOrDefaultAsync<T> can be applied only to SingleResultSpecification<T> specifications.")]
public virtual async Task<T> GetBySpecAsync(ISpecification<T> specification, CancellationToken cancellationToken = default)
{
return await ApplySpecification(specification).FirstOrDefaultAsync(cancellationToken);
}

/// <inheritdoc/>
[Obsolete]
[Obsolete("Use FirstOrDefaultAsync<T> or SingleOrDefaultAsync<T> instead. The SingleOrDefaultAsync<T> can be applied only to SingleResultSpecification<T> specifications.")]
public virtual async Task<TResult> GetBySpecAsync<TResult>(ISpecification<T, TResult> specification, CancellationToken cancellationToken = default)
{
return await ApplySpecification(specification).FirstOrDefaultAsync(cancellationToken);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,14 +94,14 @@ public virtual async Task<int> SaveChangesAsync(CancellationToken cancellationTo
}

/// <inheritdoc/>
[Obsolete]
[Obsolete("Use FirstOrDefaultAsync<T> or SingleOrDefaultAsync<T> instead. The SingleOrDefaultAsync<T> can be applied only to SingleResultSpecification<T> specifications.")]
public virtual async Task<T?> GetBySpecAsync(ISpecification<T> specification, CancellationToken cancellationToken = default)
{
return await ApplySpecification(specification).FirstOrDefaultAsync(cancellationToken);
}

/// <inheritdoc/>
[Obsolete]
[Obsolete("Use FirstOrDefaultAsync<T> or SingleOrDefaultAsync<T> instead. The SingleOrDefaultAsync<T> can be applied only to SingleResultSpecification<T> specifications.")]
public virtual async Task<TResult?> GetBySpecAsync<TResult>(ISpecification<T, TResult> specification, CancellationToken cancellationToken = default)
{
return await ApplySpecification(specification).FirstOrDefaultAsync(cancellationToken);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public interface IReadRepositoryBase<T> where T : class
/// A task that represents the asynchronous operation.
/// The task result contains the <typeparamref name="T" />, or <see langword="null"/>.
/// </returns>
[Obsolete]
[Obsolete("Use FirstOrDefaultAsync<T> or SingleOrDefaultAsync<T> instead. The SingleOrDefaultAsync<T> can be applied only to SingleResultSpecification<T> specifications.")]
Task<T?> GetBySpecAsync(ISpecification<T> specification, CancellationToken cancellationToken = default);

/// <summary>
Expand All @@ -46,7 +46,7 @@ public interface IReadRepositoryBase<T> where T : class
/// A task that represents the asynchronous operation.
/// The task result contains the <typeparamref name="TResult" />.
/// </returns>
[Obsolete]
[Obsolete("Use FirstOrDefaultAsync<T> or SingleOrDefaultAsync<T> instead. The SingleOrDefaultAsync<T> can be applied only to SingleResultSpecification<T> specifications.")]
Task<TResult?> GetBySpecAsync<TResult>(ISpecification<T, TResult> specification, CancellationToken cancellationToken = default);

/// <summary>
Expand Down

0 comments on commit fab04ee

Please sign in to comment.