diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 861b5c1..9e4ad03 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -21,7 +21,7 @@ jobs: - name: install dotnet uses: actions/setup-dotnet@v1 with: - dotnet-version: '3.1.x' + dotnet-version: 6.0.x - name: install packages run: dotnet restore diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index cb83254..4e60936 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -21,7 +21,7 @@ jobs: - name: install dotnet uses: actions/setup-dotnet@v1 with: - dotnet-version: '3.1.x' + dotnet-version: 6.0.x - name: install packages run: dotnet restore diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 78ff46c..1ebd227 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -16,7 +16,7 @@ jobs: - name: install dotnet uses: actions/setup-dotnet@v1 with: - dotnet-version: 3.1.x + dotnet-version: 6.0.x - name: install packages run: dotnet restore diff --git a/.gitignore b/.gitignore index dab9be8..6dce6e3 100644 --- a/.gitignore +++ b/.gitignore @@ -140,4 +140,6 @@ ModelManifest.xml **/.vs/config/applicationhost.config src/.vs/** -.vs/** \ No newline at end of file +.vs/** + +.idea \ No newline at end of file diff --git a/Directory.Build.props b/Directory.Build.props index 024cc08..f77ad2f 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,6 +1,6 @@ - 1.1.4 + 1.1.5 Byndyusoft.ModelResult Byndyusoft Byndyusoft;ModelResult diff --git a/README.md b/README.md index 744bc97..751c912 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # Byndyusoft.ModelResult -Result of domain model logic similar to ActionResult +The result of domain logic, similar to ActionResult | | | | | ------- | ------------ | --------- | @@ -15,7 +15,7 @@ dotnet add package Byndyusoft.ModelResult ## Usage -ModelResult can be used to return either "ok" or "error" value without explicit casting. Here are some usage examples: +ModelResult can be used to return either an "ok" value or an "error" value without explicit casting. Here are some usage examples: ```csharp public ModelResult GetId(SampleEntity entity) @@ -55,7 +55,7 @@ public ModelResult GetEntityInfoDto(SampleEntity entity) ``` # ModelResult.AspNetCore -Converter to ActionResult from ModelResult +A converter of ModelResult to ActionResult ## Installing @@ -75,11 +75,11 @@ public async Task> GetEntityInfoDto([FromRoute] long } ``` -If `result` is "ok" result then action method will return message with 200 code and dto content. Otherwise if it is "error" result it is usually will be transformed to 400 code with error info that contains code, message and items. Current version has one exception: if error code is equal to `Byndyusoft.ModelResult.Common.CommonErrorCodes.NotFound` there will be 404 code without any content. +If `result` is an "ok" result then the action method will return a message with the 200 code and the contents of the DTO. Otherwise if it is "error" result it is usually will be transformed to 400 code with error info that contains code, message and items. The current version has one exception: if an error code is equal to `Byndyusoft.ModelResult.Common.CommonErrorCodes.NotFound` there will be the 404 code without any content. # Contributing -To contribute, you will need to setup your local environment, see [prerequisites](#prerequisites). For the contribution and workflow guide, see [package development lifecycle](#package-development-lifecycle). +To contribute, you will need to setup your local environment, see [prerequisites](#prerequisites). For a contribution and workflow guide, see [package development lifecycle](#package-development-lifecycle). A detailed overview on how to contribute can be found in the [contributing guide](CONTRIBUTING.md). @@ -88,24 +88,14 @@ A detailed overview on how to contribute can be found in the [contributing guide Make sure you have installed all of the following prerequisites on your development machine: - Git - [Download & Install Git](https://git-scm.com/downloads). OSX and Linux machines typically have this already installed. -- .NET Core (version 3.1 or higher) - [Download & Install .NET Core](https://dotnet.microsoft.com/download/dotnet-core/3.1). - -## General folders layout - -### src -- source code - -### tests - -- unit-tests - +- .NET Core (version 6.0 or higher) - [Download & Install .NET Core](https://dotnet.microsoft.com/en-us/download/dotnet/6.0). ## Package development lifecycle - Implement package logic in `src` -- Add or addapt unit-tests (prefer before and simultaneously with coding) in `tests` +- Add or adapt unit-tests in `tests` - Add or change the documentation as needed -- Open pull request in the correct branch. Target the project's `master` branch +- Open pull request for a correct branch. Target the project's `master` branch # Maintainers diff --git a/src/ModelResult.AspNetCore/Byndyusoft.ModelResult.AspNetCore.csproj b/src/ModelResult.AspNetCore/Byndyusoft.ModelResult.AspNetCore.csproj index 31dbf34..6170c32 100644 --- a/src/ModelResult.AspNetCore/Byndyusoft.ModelResult.AspNetCore.csproj +++ b/src/ModelResult.AspNetCore/Byndyusoft.ModelResult.AspNetCore.csproj @@ -5,6 +5,8 @@ enable Byndyusoft.ModelResult.AspNetCore Byndyusoft.ModelResult.AspNetCore + README.md + LICENSE.txt @@ -15,4 +17,9 @@ + + + + + diff --git a/src/ModelResult/Byndyusoft.ModelResult.csproj b/src/ModelResult/Byndyusoft.ModelResult.csproj index f0bd2c1..ada2375 100644 --- a/src/ModelResult/Byndyusoft.ModelResult.csproj +++ b/src/ModelResult/Byndyusoft.ModelResult.csproj @@ -4,6 +4,13 @@ netstandard2.1 Byndyusoft.ModelResult Byndyusoft.ModelResult + README.md + LICENSE.txt + + + + + diff --git a/tests/ModelResult.UnitTests/Byndyusoft.ModelResult.UnitTests.csproj b/tests/ModelResult.UnitTests/Byndyusoft.ModelResult.UnitTests.csproj index 05c7dc9..d7c5cdd 100644 --- a/tests/ModelResult.UnitTests/Byndyusoft.ModelResult.UnitTests.csproj +++ b/tests/ModelResult.UnitTests/Byndyusoft.ModelResult.UnitTests.csproj @@ -1,7 +1,7 @@  - netcoreapp3.1 + net6.0 enable false diff --git a/tests/ModelResult.UnitTests/ModelResult/Dtos/ErrorInfoDtoTests.cs b/tests/ModelResult.UnitTests/ModelResult/Dtos/ErrorInfoDtoTests.cs index 31743c5..04acc88 100644 --- a/tests/ModelResult.UnitTests/ModelResult/Dtos/ErrorInfoDtoTests.cs +++ b/tests/ModelResult.UnitTests/ModelResult/Dtos/ErrorInfoDtoTests.cs @@ -1,6 +1,5 @@ namespace Byndyusoft.ModelResult.ModelResult.Dtos { - using System.Diagnostics.CodeAnalysis; using System.Linq; using AutoFixture; using Byndyusoft.ModelResult.Dtos; @@ -15,7 +14,7 @@ public void SetUp() _fixture = new Fixture(); } - [NotNull] private Fixture? _fixture; + private Fixture _fixture = default!; [Test] public void TestConstructorWithoutItems() diff --git a/tests/ModelResult.UnitTests/ModelResult/ModelResults/ModelResultTests.cs b/tests/ModelResult.UnitTests/ModelResult/ModelResults/ModelResultTests.cs index 6f74d80..80e885d 100644 --- a/tests/ModelResult.UnitTests/ModelResult/ModelResults/ModelResultTests.cs +++ b/tests/ModelResult.UnitTests/ModelResult/ModelResults/ModelResultTests.cs @@ -1,6 +1,5 @@ namespace Byndyusoft.ModelResult.ModelResult.ModelResults { - using System.Diagnostics.CodeAnalysis; using AutoFixture; using Byndyusoft.ModelResult.ModelResults; using NUnit.Framework; @@ -14,7 +13,7 @@ public void SetUp() _fixture = new Fixture(); } - [NotNull] private Fixture? _fixture; + private Fixture _fixture = default!; [Test] public void TestIsOk()