Skip to content

Commit

Permalink
Merge pull request #213 from hankovich/feature/make_ok_obsolete
Browse files Browse the repository at this point in the history
Add [Obsolete] on top of Result.Ok methods
  • Loading branch information
vkhorikov authored Jul 10, 2020
2 parents 98eef75 + 96a14d2 commit c10e048
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
16 changes: 6 additions & 10 deletions CSharpFunctionalExtensions/Result/Obsolete/Ok.cs
Original file line number Diff line number Diff line change
@@ -1,22 +1,18 @@
namespace CSharpFunctionalExtensions
using System;

namespace CSharpFunctionalExtensions
{
public partial struct Result
{
/// <summary>
/// Deprecated. Use Success() instead.
/// </summary>
[Obsolete("Use Success() instead.")]
public static Result Ok()
=> Success();

/// <summary>
/// Deprecated. Use Success() instead.
/// </summary>
[Obsolete("Use Success() instead.")]
public static Result<T> Ok<T>(T value)
=> Success(value);

/// <summary>
/// Deprecated. Use Success() instead.
/// </summary>
[Obsolete("Use Success() instead.")]
public static Result<T, E> Ok<T, E>(T value)
=> Success<T, E>(value);
}
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ return _customerRepository.GetById(id)
return _customerRepository.GetById(id)
.ToResult("Customer with such Id is not found: " + id)
.Ensure(customer => customer.CanBePromoted(), "The customer has the highest status possible")
.WithTransactionScope(customer => Result.Ok(customer)
.WithTransactionScope(customer => Result.Success(customer)
.Tap(customer => customer.Promote())
.Tap(customer => customer.ClearAppointments()))
.Tap(customer => _emailGateway.SendPromotionNotification(customer.PrimaryEmail, customer.Status))
Expand Down

0 comments on commit c10e048

Please sign in to comment.