Skip to content

Commit 425508c

Browse files
author
Iain Scott
committed
Copied Entity type from projects currently using it.
1 parent 65f9d3e commit 425508c

File tree

9 files changed

+527
-0
lines changed

9 files changed

+527
-0
lines changed

.gitignore

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
*.swp
2+
*~
3+
4+
.vs/
5+
6+
.idea/
7+
8+
## Ignore Visual Studio temporary files, build results, and
9+
## files generated by popular Visual Studio add-ons.
10+
11+
# User-specific files
12+
*.suo
13+
*.user
14+
*.sln.docstates
15+
16+
# Build results
17+
[Dd]ebug/
18+
[Dd]ebugPublic/
19+
[Rr]elease/
20+
x64/
21+
build/
22+
bld/
23+
[Bb]in/
24+
[Oo]bj/
25+
26+
# MSTest test Results
27+
[Tt]est[Rr]esult*/
28+
[Bb]uild[Ll]og.*
29+
30+
#NUNIT
31+
*.VisualState.xml
32+
TestResult.xml
33+
34+
# Visual C++ cache files
35+
ipch/
36+
*.aps
37+
*.ncb
38+
*.opensdf
39+
*.sdf
40+
*.cachefile
41+
42+
# Visual Studio profiler
43+
*.psess
44+
*.vsp
45+
*.vspx
46+
47+
# ReSharper is a .NET coding add-in
48+
_ReSharper*/
49+
*.[Rr]e[Ss]harper
50+
*.DotSettings.user
51+
52+
# TeamCity is a build add-in
53+
_TeamCity*
54+
55+
# DotCover is a Code Coverage Tool
56+
*.dotCover
57+
58+
# Click-Once directory
59+
publish/
60+
61+
# Publish Web Output
62+
*.[Pp]ublish.xml
63+
*.azurePubxml
64+
*.pubxml
65+
66+
# NuGet Packages Directory
67+
packages/*
68+
## TODO: If the tool you use requires repositories.config
69+
## uncomment the next line
70+
#!packages/repositories.config
71+
72+
# Enable "build/" folder in the NuGet Packages folder since
73+
# NuGet packages use it for MSBuild targets.
74+
# This line needs to be after the ignore of the build folder
75+
# (and the packages folder if the line above has been uncommented)
76+
!packages/build/
77+
78+
# Others
79+
*.Cache
80+
ClientBin/
81+
~$*
82+
*~
83+
*.dbmdl
84+
*.dbproj.schemaview
85+
*.pfx
86+
*.publishsettings
87+
node_modules/
88+
89+
# Backup & report files from converting an old project file
90+
# to a newer Visual Studio version. Backup files are not needed,
91+
# because we have git ;-)
92+
_UpgradeReport_Files/
93+
Backup*/
94+
UpgradeLog*.XML
95+
UpgradeLog*.htm
96+
97+
# SQL Server files
98+
*.mdf
99+
*.ldf
100+
101+
## Certificates
102+
*.pem
103+
104+
logs/
105+
*.log
106+
*.sln.DotSettings

GitVersionConfig.yaml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
assembly-versioning-scheme: MajorMinorPatch
2+
mode: ContinuousDeployment
3+
4+
# It would be better to use smarter regexes instead of duplicating everything for local and remote cases.
5+
# However, GitVersion has some built-in patterns which cannot be removed and these would cause clashes.
6+
branches:
7+
8+
# These branch patterns cover all local cases
9+
master:
10+
regex: master
11+
tag: master
12+
increment: Minor
13+
prevent-increment-of-merged-branch-version: true
14+
feature:
15+
regex: feature[/-]
16+
tag: a{BranchName}
17+
increment: Minor
18+
prevent-increment-of-merged-branch-version: false
19+
patch:
20+
regex: patch[/-]
21+
tag: useBranchName
22+
increment: Patch
23+
prevent-increment-of-merged-branch-version: false
24+
release:
25+
regex: release[/-]
26+
tag: rc
27+
increment: None
28+
prevent-increment-of-merged-branch-version: false
29+
30+
# These branch patterns cover all remote cases
31+
origin/master:
32+
regex: origin/master
33+
tag: master
34+
increment: Minor
35+
prevent-increment-of-merged-branch-version: true
36+
origin/feature:
37+
regex: origin/feature[/-]
38+
tag: a{BranchName}
39+
increment: Minor
40+
prevent-increment-of-merged-branch-version: false
41+
origin/patch:
42+
regex: origin/patch[/-]
43+
tag: useBranchName
44+
increment: Patch
45+
prevent-increment-of-merged-branch-version: false
46+
origin/release:
47+
regex: origin/release[/-]
48+
tag: rc
49+
increment: None
50+
prevent-increment-of-merged-branch-version: false

Jenkinsfile

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#!groovy
2+
3+
node {
4+
step([$class: 'StashNotifier'])
5+
try {
6+
stage("Clone") {
7+
checkout scm
8+
}
9+
10+
stage("Restore") {
11+
bat "dotnet restore --source https://packages/repository/nuget-group-libs/"
12+
}
13+
14+
stage("Build") {
15+
bat("\"${tool 'MSBuild15'}\" /p:Configuration=Release")
16+
}
17+
18+
stage("Test") {
19+
dir("test\\Winton.DomainModelling.Abstractions.Tests") {
20+
bat("dotnet test Winton.DomainModelling.Abstractions.Tests.csproj --configuration Release --no-restore --no-build")
21+
}
22+
}
23+
24+
stage("Publish") {
25+
dir("src\\Winton.DomainModelling.Abstractions.Tests\\bin") {
26+
bat("dotnet nuget push **\\*.nupkg --source https://packages/repository/nuget-hosted-libs/")
27+
}
28+
}
29+
30+
stage("Archive") {
31+
archive "**\\*.nupkg"
32+
}
33+
34+
currentBuild.result = "SUCCESS"
35+
}
36+
catch (err) {
37+
currentBuild.result = "FAILURE"
38+
throw err
39+
}
40+
finally{
41+
step([$class: 'StashNotifier'])
42+
}
43+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio 15
4+
VisualStudioVersion = 15.0.27703.2026
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{697902B3-26B1-490D-BC64-39298D6DAFC4}"
7+
EndProject
8+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{02075BDC-A66D-4346-8093-2F2667660F36}"
9+
EndProject
10+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Winton.DomainModelling.Abstractions", "src\Winton.DomainModelling.Abstractions\Winton.DomainModelling.Abstractions.csproj", "{4CC49F58-367B-4E87-8925-49D913FA7BD1}"
11+
EndProject
12+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Winton.DomainModelling.Abstractions.Tests", "test\Winton.DomainModelling.Abstractions.Tests\Winton.DomainModelling.Abstractions.Tests.csproj", "{8FD5A9B0-44ED-470F-A0F0-721E55B5790D}"
13+
EndProject
14+
Global
15+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
16+
Debug|Any CPU = Debug|Any CPU
17+
Release|Any CPU = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
20+
{4CC49F58-367B-4E87-8925-49D913FA7BD1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
21+
{4CC49F58-367B-4E87-8925-49D913FA7BD1}.Debug|Any CPU.Build.0 = Debug|Any CPU
22+
{4CC49F58-367B-4E87-8925-49D913FA7BD1}.Release|Any CPU.ActiveCfg = Release|Any CPU
23+
{4CC49F58-367B-4E87-8925-49D913FA7BD1}.Release|Any CPU.Build.0 = Release|Any CPU
24+
{8FD5A9B0-44ED-470F-A0F0-721E55B5790D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
25+
{8FD5A9B0-44ED-470F-A0F0-721E55B5790D}.Debug|Any CPU.Build.0 = Debug|Any CPU
26+
{8FD5A9B0-44ED-470F-A0F0-721E55B5790D}.Release|Any CPU.ActiveCfg = Release|Any CPU
27+
{8FD5A9B0-44ED-470F-A0F0-721E55B5790D}.Release|Any CPU.Build.0 = Release|Any CPU
28+
EndGlobalSection
29+
GlobalSection(SolutionProperties) = preSolution
30+
HideSolutionNode = FALSE
31+
EndGlobalSection
32+
GlobalSection(NestedProjects) = preSolution
33+
{4CC49F58-367B-4E87-8925-49D913FA7BD1} = {697902B3-26B1-490D-BC64-39298D6DAFC4}
34+
{8FD5A9B0-44ED-470F-A0F0-721E55B5790D} = {02075BDC-A66D-4346-8093-2F2667660F36}
35+
EndGlobalSection
36+
GlobalSection(ExtensibilityGlobals) = postSolution
37+
SolutionGuid = {6AC36F05-9D1F-4E69-A8F5-3A36B8065019}
38+
EndGlobalSection
39+
EndGlobal
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
using System;
2+
3+
namespace Winton.DomainModelling
4+
{
5+
public abstract class Entity<TEntityId> : IEquatable<Entity<TEntityId>>
6+
where TEntityId : IEquatable<TEntityId>
7+
{
8+
protected Entity(TEntityId id)
9+
{
10+
Id = id;
11+
}
12+
13+
public TEntityId Id { get; }
14+
15+
public static bool operator ==(Entity<TEntityId> left, Entity<TEntityId> right)
16+
{
17+
return Equals(left, right);
18+
}
19+
20+
public static bool operator !=(Entity<TEntityId> left, Entity<TEntityId> right)
21+
{
22+
return !Equals(left, right);
23+
}
24+
25+
public bool Equals(Entity<TEntityId> other)
26+
{
27+
if (other is null)
28+
{
29+
return false;
30+
}
31+
32+
if (ReferenceEquals(this, other))
33+
{
34+
return true;
35+
}
36+
37+
if (GetType() != other.GetType())
38+
{
39+
return false;
40+
}
41+
42+
return !Id.Equals(default(TEntityId)) && !other.Id.Equals(default(TEntityId)) && Id.Equals(other.Id);
43+
}
44+
45+
public override bool Equals(object obj)
46+
{
47+
return Equals(obj as Entity<TEntityId>);
48+
}
49+
50+
public override int GetHashCode()
51+
{
52+
return Id.GetHashCode();
53+
}
54+
}
55+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<Authors>Winton</Authors>
5+
<Company>Winton</Company>
6+
<Copyright>Copyright 2018 Winton</Copyright>
7+
<Description>Provides common abstractions for domain modelling.</Description>
8+
<GenerateDocumentationFile>False</GenerateDocumentationFile>
9+
<NoWarn>$(NoWarn);SA0001;SA1101;SA1309;SA1413;SA1633;SA1652</NoWarn>
10+
<PackageId>Winton.DomainModelling.Abstractions</PackageId>
11+
<PackageRequireLicenseAcceptance>False</PackageRequireLicenseAcceptance>
12+
<PackageTags>Winton, Domain, Driven, Design, Modelling, Abstractions, DDD</PackageTags>
13+
<PackageVersion>$(NuGetVersion)</PackageVersion>
14+
<RootNamespace>Winton.DomainModelling</RootNamespace>
15+
<TargetFramework>netstandard1.0</TargetFramework>
16+
<Title>Winton Domain Modelling Abstractions</Title>
17+
<TreatWarningsAsErrors>True</TreatWarningsAsErrors>
18+
</PropertyGroup>
19+
20+
<PropertyGroup Condition="'$(Configuration)' == 'Release'">
21+
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
22+
</PropertyGroup>
23+
24+
<ItemGroup>
25+
<AdditionalFiles Include="..\..\stylecop.json" />
26+
</ItemGroup>
27+
28+
<ItemGroup>
29+
<PackageReference Include="Bt.Tooling.ReSharper" Version="1.3.0" PrivateAssets="All" />
30+
<PackageReference Include="GitVersionTask" Version="4.0.0-beta0012" PrivateAssets="All" />
31+
<PackageReference Include="StyleCop.Analyzers" Version="1.0.2" PrivateAssets="All" />
32+
</ItemGroup>
33+
34+
</Project>

stylecop.json

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"$schema":
3+
"https://raw.githubusercontent.com/DotNetAnalyzers/StyleCopAnalyzers/1.0.2/StyleCop.Analyzers/StyleCop.Analyzers/Settings/stylecop.schema.json",
4+
"settings": {
5+
"documentationRules": {
6+
"documentExposedElements": false,
7+
"documentInterfaces": false,
8+
"documentInternalElements": false,
9+
"xmlHeader": false
10+
},
11+
"maintainabilityRules": {
12+
"topLevelTypes": [
13+
"class",
14+
"enum",
15+
"interface",
16+
"struct"
17+
]
18+
},
19+
"orderingRules": {
20+
"blankLinesBetweenUsingGroups": "omit",
21+
"usingDirectivesPlacement": "outsideNamespace"
22+
}
23+
}
24+
}

0 commit comments

Comments
 (0)