MethodResultWrapper 3.0.6

dotnet add package MethodResultWrapper --version 3.0.6                
NuGet\Install-Package MethodResultWrapper -Version 3.0.6                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="MethodResultWrapper" Version="3.0.6" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add MethodResultWrapper --version 3.0.6                
#r "nuget: MethodResultWrapper, 3.0.6"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install MethodResultWrapper as a Cake Addin
#addin nuget:?package=MethodResultWrapper&version=3.0.6

// Install MethodResultWrapper as a Cake Tool
#tool nuget:?package=MethodResultWrapper&version=3.0.6                

Method Result Wrapper by pvWay

Provides a generic wrapper that returns whether or not a method succeeded or failed carrying the method result on success or a list of notifications in case of failure. As of version 3.0.0 the package includes the DsoHttpResult<T> object that enables to standardize response from Web API. See interface here after. As of version 3.0.4 the pakcage can be used with the Oracle.LogWriter As of version 3.0.5 all methods also have an async overload As of version 3.0.6 you may add notifications to an existing result

Interfaces

MethodResult interfaces

    public interface IMethodResult
    {
        /// <summary>
        /// At least one notification has a severity
        /// greater or equal to Error
        /// </summary>
        bool Failure { get; }

        /// <summary>
        /// No notification or all notifications severity
        /// are lower than Error
        /// </summary>
        bool Success { get; }

        SeverityEnum Severity { get; }

        /// <summary>
        /// Bulk string made of the concatenation
        /// of the notifications separated by new
        /// lines
        /// </summary>
        string ErrorMessage { get; }

        IEnumerable<IMethodResultNotification> Notifications { get; }

        void AddNotification(string message, SeverityEnum severity);
        void AddNotification(IMethodResultNotification notification);

        /// <summary>
        /// Will throw new Exception(ErrorMessage)
        /// </summary>
        void Throw();
    }

    public interface IMethodResult<out T> : IMethodResult
    {
        T Data { get; }
    }

    public interface IMethodResultNotification
    {
        SeverityEnum Severity { get; }
        string Message { get; }
    }

ILoggerService interface

  • The ILoggerService provides both sync and async methods with serveral signatures including (1) simple message, (2) list of messages, (3) MethodResult object (see above) (4) Exception

  • Each log row is also qualified by a Severity level from Debug to Fatal and enables also some interesting meta data like (1) UserId, (2) CompanyId, (3) Topic (4) MachineName

  • The service will also capture MemberName, FilePath and LineNumber

  • Remark 1 : package pvWay.MsSqlLogWriterFw enables to persist the logs into an MSSql database

  • Remark 2 : package pvWay.OracleLogWriterFw enables to persist the logs into an Oracle database

Happy coding

Product Compatible and additional computed target framework versions.
.NET Framework net461 is compatible.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on MethodResultWrapper:

Package Downloads
MsSqlLoggerService

Ms Sql implementation of MethodResultWrapper ILoggerService. Persists logs into a MsSql table.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
3.0.6 1,395 9/22/2021
3.0.5 848 4/28/2021
3.0.4 780 4/27/2021
3.0.3 1,373 6/10/2020
3.0.2 965 6/10/2020
3.0.1 930 6/10/2020
3.0.0 1,087 6/10/2020
2.0.1 1,235 3/20/2020
2.0.0 1,051 3/19/2020 2.0.0 is deprecated because it has critical bugs.
1.1.3 966 3/20/2020
1.1.2 1,092 3/19/2020 1.1.2 is deprecated because it has critical bugs.
1.1.0 1,398 3/7/2020
1.0.0 979 2/28/2020

Now possible to add notifications