Added little skip for results returning, Ok, Fault and Next properties to UpdateHandlerBase, now instaed of 'return Result.Ok();' you can just type 'return Ok;'
This commit is contained in:
@@ -21,6 +21,15 @@ namespace Telegrator.Handlers.Components
|
||||
/// </summary>
|
||||
public HandlerLifetimeToken LifetimeToken { get; } = new HandlerLifetimeToken();
|
||||
|
||||
/// <inheritdoc cref="Result.Ok"/>
|
||||
public Result Ok => Result.Ok();
|
||||
|
||||
/// <inheritdoc cref="Result.Fault"/>
|
||||
public Result Fault => Result.Fault();
|
||||
|
||||
/// <inheritdoc cref="Result.Next"/>
|
||||
public Result Next => Result.Next();
|
||||
|
||||
/// <summary>
|
||||
/// Executes the handler logic and marks the lifetime as ended after execution.
|
||||
/// </summary>
|
||||
|
||||
@@ -12,6 +12,10 @@ namespace Telegrator
|
||||
/// </summary>
|
||||
public sealed class Result
|
||||
{
|
||||
private static readonly Result ok = new Result(true, false, null);
|
||||
private static readonly Result fault = new Result(false, false, null);
|
||||
private static readonly Result next = new Result(true, true, null);
|
||||
|
||||
/// <summary>
|
||||
/// Is result positive
|
||||
/// </summary>
|
||||
@@ -44,7 +48,7 @@ namespace Telegrator
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static Result Ok()
|
||||
=> new Result(true, false, null);
|
||||
=> ok;
|
||||
|
||||
/// <summary>
|
||||
/// Represents 'fault' or 'error'. Use cases:
|
||||
@@ -55,7 +59,7 @@ namespace Telegrator
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static Result Fault()
|
||||
=> new Result(false, false, null);
|
||||
=> fault;
|
||||
|
||||
/// <summary>
|
||||
/// Represents 'continue'. Use cases:
|
||||
@@ -66,7 +70,7 @@ namespace Telegrator
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static Result Next()
|
||||
=> new Result(true, true, null);
|
||||
=> next;
|
||||
|
||||
/// <summary>
|
||||
/// Represents 'chain'. Use cases:
|
||||
|
||||
Reference in New Issue
Block a user