Skip to content

Commit efede0d

Browse files
Update to net6.0, moved to GitHub actions, removed deprecations (#15)
1 parent ad04873 commit efede0d

30 files changed

+2214
-2386
lines changed

.github/workflows/build.yml

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
name: Build
2+
on:
3+
push:
4+
branches:
5+
- master
6+
tags:
7+
- "*"
8+
pull_request:
9+
jobs:
10+
calculate-version:
11+
runs-on: ubuntu-20.04
12+
outputs:
13+
version: ${{ steps.version.outputs.version }}
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@master
17+
with:
18+
fetch-depth: 0
19+
- name: Install GitVersion
20+
uses: gittools/actions/gitversion/[email protected]
21+
with:
22+
versionSpec: "5.8.1"
23+
- name: Run GitVersion
24+
id: gitversion
25+
uses: gittools/actions/gitversion/[email protected]
26+
- name: Version
27+
id: version
28+
run: |
29+
version=${{ steps.gitversion.outputs.nuGetVersionV2 }}
30+
if [ "${{ github.event_name }}" == "pull_request" ]
31+
then
32+
version=${version}-${{ steps.gitversion.outputs.shortSha }}
33+
fi
34+
echo "::set-output name=version::${version}"
35+
build:
36+
runs-on: ${{ matrix.os }}
37+
needs: [calculate-version]
38+
strategy:
39+
matrix:
40+
include:
41+
- os: ubuntu-20.04
42+
nugetPush: false
43+
- os: windows-2019
44+
nugetPush: true
45+
- os: macos-10.15
46+
nugetPush: false
47+
steps:
48+
- name: Checkout code
49+
uses: actions/checkout@master
50+
with:
51+
fetch-depth: 0
52+
submodules: recursive
53+
- name: Setup dotnet SDK
54+
uses: actions/setup-dotnet@v1
55+
with:
56+
dotnet-version: "6.0.101"
57+
- name: Build
58+
run: |
59+
dotnet build -c Release -p:Version=${{ needs.calculate-version.outputs.version }}
60+
shell: bash
61+
- name: Test
62+
run: dotnet test -c Release --no-build
63+
shell: bash
64+
- name: Archive NuGet Packages
65+
uses: actions/upload-artifact@v2
66+
if: ${{ matrix.nugetPush }}
67+
with:
68+
name: packages
69+
path: |
70+
**/*.nupkg
71+
**/*.snupkg
72+
retention-days: 1
73+
nuget-push:
74+
runs-on: ubuntu-20.04
75+
needs: [build]
76+
if: github.event_name != 'pull_request'
77+
steps:
78+
- name: Download NuGet Packages
79+
uses: actions/download-artifact@v2
80+
with:
81+
name: packages
82+
- name: NuGet Push
83+
run: dotnet nuget push **/*.nupkg -s https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_API_KEY }}

.travis.yml

Lines changed: 0 additions & 21 deletions
This file was deleted.

Directory.Build.props

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
<PropertyGroup>
33
<Authors>Winton</Authors>
44
<Company>Winton</Company>
5-
<Copyright>Copyright 2020 Winton</Copyright>
5+
<Copyright>Copyright 2022 Winton</Copyright>
66
<CodeAnalysisRuleSet>$(MSBuildThisFileDirectory)Rules.ruleset</CodeAnalysisRuleSet>
7-
<LangVersion>8.0</LangVersion>
7+
<LangVersion>10.0</LangVersion>
88
<Nullable>enable</Nullable>
99
<TreatWarningsAsErrors>True</TreatWarningsAsErrors>
1010
</PropertyGroup>

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright 2018 Winton
1+
Copyright 2022 Winton
22

33
Licensed under the Apache License, Version 2.0 (the "License");
44
you may not use this file except in compliance with the License.

README.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
# Winton.DomainModelling.Abstractions
22

3-
[![Appveyor](https://ci.appveyor.com/api/projects/status/7mba8m947ed603r1?svg=true)](https://ci.appveyor.com/project/wintoncode/winton-domainmodelling-abstractions/branch/master)
4-
[![Travis CI](https://travis-ci.com/wintoncode/Winton.DomainModelling.Abstractions.svg?branch=master)](https://travis-ci.com/wintoncode/Winton.DomainModelling.Abstractions)
5-
[![NuGet version](https://img.shields.io/nuget/v/Winton.DomainModelling.Abstractions.svg)](https://www.nuget.org/packages/Winton.DomainModelling.Abstractions)
6-
[![NuGet version](https://img.shields.io/nuget/vpre/Winton.DomainModelling.Abstractions.svg)](https://www.nuget.org/packages/Winton.DomainModelling.Abstractions)
7-
83
Abstractions useful for modelling a domain.
94

5+
[![NuGet Badge](https://buildstats.info/nuget/Winton.DomainModelling.Abstractions)](https://www.nuget.org/packages/Winton.DomainModelling.Abstractions/)
6+
7+
[![Build history](https://buildstats.info/github/chart/wintoncode/Winton.DomainModelling.Abstractions?branch=master)](https://github.com/wintoncode/Winton.DomainModelling.Abstractions/actions)
8+
109
## Building blocks
1110

1211
### `Entity`
@@ -16,7 +15,7 @@ Instances are equal if their IDs are equal. Any equatable ID type can be used.
1615

1716
## Results
1817

19-
### `Result<TData>`
18+
### `Result<TData>`
2019

2120
Represents the result of a domain operation that returns data of type `TData`. It is an abstract type with exactly two concretions: `Success` and `Failure`. It is a specialisation of the more generic `Either` type found in functional programming and is inspired by [Scott Wlaschin's Railway Oriented Programming](https://fsharpforfunandprofit.com/rop/) in F#.
2221

@@ -41,6 +40,7 @@ public Person GetAdult(int id)
4140
```
4241

4342
This implementation has two major drawbacks:
43+
4444
1) From a client's perspective, the API is not expressive enough. The method signature gives no indication that it might throw, so the client would need to peek inside to find that out.
4545
2) From an implementer's perspective, the error checking, whilst simple enough in this example, can often grow quite complex. This makes the implementation of the method hard to follow due to the number of conditional branches. We may try factoring out the condition checking blocks into separate methods to solve this problem. This would also allow us to share some of this logic with other parts of the code base. These factored-out methods would then have a signature like `void CheckPersonExists(Person person)`. Again, this signature tells us nothing about the fact that the method might throw an exception. Currently, the compiler is also not able to do the flow analysis necessary to determine that the `person` is not `null` after calling such a method and so we may be left with warnings in the original call site about possible null references, even though we know we've checked for that condition.
4646

@@ -66,7 +66,8 @@ Now we have a much more expressive method signature, which indicates that we mig
6666

6767
If the operation has no data to return then a `Result<Unit>` can be used. `Unit` is a special type that indicates the absence of a value, because `void` is not a valid type in C#.
6868

69-
Some recommendations on using `Result` types:
69+
Some recommendations on using `Result` types:
70+
7071
* Make all public domain methods return a `Result<TData>`. Most domain operations will have a failure case that the client should be informed about, but even if they don't, by returning `Result` now it can be easily added later without breaking the public API.
7172
* Once an operation is in "result space", keep it there for as long as possible. `Result` has a fluent API to facilitate this. This is similar to how, once one operation becomes `async` it is best to make all surrounding operations `async` too. This can be re-phrased as, don't match on the result until the last possible moment. For example, in a web API this would mean only unwrapping the result in the Controller.
7273

@@ -83,6 +84,7 @@ Represents a failed `Result`. When constructed it takes an `Error` which contain
8384
Like exceptions, errors form a hierarchy, with all errors deriving from the base `Error` type. This library defines a few common domain error types, which are listed below, but it is expected that more specific errors will be defined on a per-domain basis.
8485

8586
Some recommendations on designing errors:
87+
8688
* Try not to create custom errors that are too granular. Model them as you would entities and use the language of the domain model to guide their creation. The concept should make sense to a domain expert.
8789
* The title should be the same for all instances of the error. The details are where instance specific information can be provided. If you are creating a custom error, make the title static and only let clients customise the details. See implementations of errors in this library for examples.
8890
* Only use them for domain errors. Exceptions should still be used for system failures, such as network requests, and programming errors.

Winton.DomainModelling.Abstractions.sln

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{859C9252-D63B-4ECB-9AB5-0BA8415C76AE}"
77
ProjectSection(SolutionItems) = preProject
88
.gitignore = .gitignore
9-
.travis.yml = .travis.yml
10-
appveyor.yml = appveyor.yml
119
CONTRIBUTING.md = CONTRIBUTING.md
1210
Directory.Build.props = Directory.Build.props
1311
GitVersion.yml = GitVersion.yml

appveyor.yml

Lines changed: 0 additions & 27 deletions
This file was deleted.

0 commit comments

Comments
 (0)