Skip to content

Commit 6d2416b

Browse files
authored
Merge pull request #48 from codepb/develop
v2 release
2 parents fcaf84a + 37829a5 commit 6d2416b

File tree

104 files changed

+3637
-1867
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

104 files changed

+3637
-1867
lines changed

DDDToolkit.sln

Lines changed: 13 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{57967491
1515
EndProject
1616
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DDDToolkit.Core.Tests", "tests\DDDToolkit.Core.Tests\DDDToolkit.Core.Tests.csproj", "{4E33A86B-6589-4501-A43A-F5A9E31AD35F}"
1717
EndProject
18-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DDDToolkit.API", "src\DDDToolkit.API\DDDToolkit.API.csproj", "{12926EE6-E9DF-4143-B1B6-016F9DE490DA}"
19-
EndProject
2018
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DDDToolkit.Utilities", "src\DDDToolkit.Utilities\DDDToolkit.Utilities.csproj", "{0E06C087-FF39-4382-910C-2EC303FC4DA0}"
2119
EndProject
2220
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DDDToolkit.EntityFramework.Extensions", "src\DDDToolkit.EntityFramework.Extensions\DDDToolkit.EntityFramework.Extensions.csproj", "{6F2563E8-BCF6-4751-9B23-4CE8426CFE42}"
@@ -35,11 +33,11 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DDDToolkit.Samples.Library.
3533
EndProject
3634
Project("{00D1A9C2-B5F0-4AF3-8072-F6C62B433612}") = "DDDToolkit.Samples.Library.Repository.Database", "samples\library\DDDToolkit.Samples.Library.Repository.Database\DDDToolkit.Samples.Library.Repository.Database.sqlproj", "{1D41D8D2-B6A5-47DD-8E98-9512EC48B429}"
3735
EndProject
38-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DDDToolkit.Querying", "src\DDDToolkit.Querying\DDDToolkit.Querying.csproj", "{AAAF943F-C3DE-4BD5-BC2D-850E77A9B607}"
36+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DDDToolkit.Validation", "src\DDDToolkit.Validation\DDDToolkit.Validation.csproj", "{0D0A57EF-3B95-4D6B-A3E6-0217FEB0DC6F}"
3937
EndProject
40-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DDDToolkit.Querying.Tests", "tests\DDDToolkit.Querying.Tests\DDDToolkit.Querying.Tests.csproj", "{4D18A7F4-169C-4399-BFF3-F2F8AE665C55}"
38+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DDDToolkit.EventSourcing", "src\DDDToolkit.EventSourcing\DDDToolkit.EventSourcing.csproj", "{EE8BBDB2-9128-4C5C-9648-53371FE3C3BE}"
4139
EndProject
42-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DDDToolkit.Validation", "src\DDDToolkit.Validation\DDDToolkit.Validation.csproj", "{0D0A57EF-3B95-4D6B-A3E6-0217FEB0DC6F}"
40+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DDDToolkit.EventSourcing.Tests", "tests\DDDToolkit.EventSourcing.Tests\DDDToolkit.EventSourcing.Tests.csproj", "{37BE5ED1-05A9-491B-B8DA-F751882E20B0}"
4341
EndProject
4442
Global
4543
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -63,10 +61,6 @@ Global
6361
{4E33A86B-6589-4501-A43A-F5A9E31AD35F}.Debug|Any CPU.Build.0 = Debug|Any CPU
6462
{4E33A86B-6589-4501-A43A-F5A9E31AD35F}.Release|Any CPU.ActiveCfg = Release|Any CPU
6563
{4E33A86B-6589-4501-A43A-F5A9E31AD35F}.Release|Any CPU.Build.0 = Release|Any CPU
66-
{12926EE6-E9DF-4143-B1B6-016F9DE490DA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
67-
{12926EE6-E9DF-4143-B1B6-016F9DE490DA}.Debug|Any CPU.Build.0 = Debug|Any CPU
68-
{12926EE6-E9DF-4143-B1B6-016F9DE490DA}.Release|Any CPU.ActiveCfg = Release|Any CPU
69-
{12926EE6-E9DF-4143-B1B6-016F9DE490DA}.Release|Any CPU.Build.0 = Release|Any CPU
7064
{0E06C087-FF39-4382-910C-2EC303FC4DA0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
7165
{0E06C087-FF39-4382-910C-2EC303FC4DA0}.Debug|Any CPU.Build.0 = Debug|Any CPU
7266
{0E06C087-FF39-4382-910C-2EC303FC4DA0}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -97,18 +91,18 @@ Global
9791
{1D41D8D2-B6A5-47DD-8E98-9512EC48B429}.Release|Any CPU.ActiveCfg = Release|Any CPU
9892
{1D41D8D2-B6A5-47DD-8E98-9512EC48B429}.Release|Any CPU.Build.0 = Release|Any CPU
9993
{1D41D8D2-B6A5-47DD-8E98-9512EC48B429}.Release|Any CPU.Deploy.0 = Release|Any CPU
100-
{AAAF943F-C3DE-4BD5-BC2D-850E77A9B607}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
101-
{AAAF943F-C3DE-4BD5-BC2D-850E77A9B607}.Debug|Any CPU.Build.0 = Debug|Any CPU
102-
{AAAF943F-C3DE-4BD5-BC2D-850E77A9B607}.Release|Any CPU.ActiveCfg = Release|Any CPU
103-
{AAAF943F-C3DE-4BD5-BC2D-850E77A9B607}.Release|Any CPU.Build.0 = Release|Any CPU
104-
{4D18A7F4-169C-4399-BFF3-F2F8AE665C55}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
105-
{4D18A7F4-169C-4399-BFF3-F2F8AE665C55}.Debug|Any CPU.Build.0 = Debug|Any CPU
106-
{4D18A7F4-169C-4399-BFF3-F2F8AE665C55}.Release|Any CPU.ActiveCfg = Release|Any CPU
107-
{4D18A7F4-169C-4399-BFF3-F2F8AE665C55}.Release|Any CPU.Build.0 = Release|Any CPU
10894
{0D0A57EF-3B95-4D6B-A3E6-0217FEB0DC6F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
10995
{0D0A57EF-3B95-4D6B-A3E6-0217FEB0DC6F}.Debug|Any CPU.Build.0 = Debug|Any CPU
11096
{0D0A57EF-3B95-4D6B-A3E6-0217FEB0DC6F}.Release|Any CPU.ActiveCfg = Release|Any CPU
11197
{0D0A57EF-3B95-4D6B-A3E6-0217FEB0DC6F}.Release|Any CPU.Build.0 = Release|Any CPU
98+
{EE8BBDB2-9128-4C5C-9648-53371FE3C3BE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
99+
{EE8BBDB2-9128-4C5C-9648-53371FE3C3BE}.Debug|Any CPU.Build.0 = Debug|Any CPU
100+
{EE8BBDB2-9128-4C5C-9648-53371FE3C3BE}.Release|Any CPU.ActiveCfg = Release|Any CPU
101+
{EE8BBDB2-9128-4C5C-9648-53371FE3C3BE}.Release|Any CPU.Build.0 = Release|Any CPU
102+
{37BE5ED1-05A9-491B-B8DA-F751882E20B0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
103+
{37BE5ED1-05A9-491B-B8DA-F751882E20B0}.Debug|Any CPU.Build.0 = Debug|Any CPU
104+
{37BE5ED1-05A9-491B-B8DA-F751882E20B0}.Release|Any CPU.ActiveCfg = Release|Any CPU
105+
{37BE5ED1-05A9-491B-B8DA-F751882E20B0}.Release|Any CPU.Build.0 = Release|Any CPU
112106
EndGlobalSection
113107
GlobalSection(SolutionProperties) = preSolution
114108
HideSolutionNode = FALSE
@@ -118,7 +112,6 @@ Global
118112
{C6748BFC-81EA-4C73-9B49-EC3534BDA722} = {EF054C6D-056E-417A-A40A-376A20DF90A6}
119113
{849591EE-EEF6-4B29-97AA-34F532C2A642} = {EF054C6D-056E-417A-A40A-376A20DF90A6}
120114
{4E33A86B-6589-4501-A43A-F5A9E31AD35F} = {57967491-B4BB-44B9-B270-6533A1E388B0}
121-
{12926EE6-E9DF-4143-B1B6-016F9DE490DA} = {EF054C6D-056E-417A-A40A-376A20DF90A6}
122115
{0E06C087-FF39-4382-910C-2EC303FC4DA0} = {EF054C6D-056E-417A-A40A-376A20DF90A6}
123116
{6F2563E8-BCF6-4751-9B23-4CE8426CFE42} = {EF054C6D-056E-417A-A40A-376A20DF90A6}
124117
{BDD881C3-118B-42D6-9D77-DDAB213CA4B0} = {175A537D-B6E1-4194-8895-D1870CF866E2}
@@ -127,9 +120,9 @@ Global
127120
{95D67484-5CDD-4CA2-8457-B4A5D42D4D3C} = {BDD881C3-118B-42D6-9D77-DDAB213CA4B0}
128121
{6DD4F5BC-B48B-43A6-A048-28F8BD04D7F6} = {BDD881C3-118B-42D6-9D77-DDAB213CA4B0}
129122
{1D41D8D2-B6A5-47DD-8E98-9512EC48B429} = {BDD881C3-118B-42D6-9D77-DDAB213CA4B0}
130-
{AAAF943F-C3DE-4BD5-BC2D-850E77A9B607} = {EF054C6D-056E-417A-A40A-376A20DF90A6}
131-
{4D18A7F4-169C-4399-BFF3-F2F8AE665C55} = {57967491-B4BB-44B9-B270-6533A1E388B0}
132123
{0D0A57EF-3B95-4D6B-A3E6-0217FEB0DC6F} = {EF054C6D-056E-417A-A40A-376A20DF90A6}
124+
{EE8BBDB2-9128-4C5C-9648-53371FE3C3BE} = {EF054C6D-056E-417A-A40A-376A20DF90A6}
125+
{37BE5ED1-05A9-491B-B8DA-F751882E20B0} = {57967491-B4BB-44B9-B270-6533A1E388B0}
133126
EndGlobalSection
134127
GlobalSection(ExtensibilityGlobals) = postSolution
135128
SolutionGuid = {E3DCC906-DD65-4478-A617-AC943C719834}

azure-pipelines.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# ASP.NET Core
2+
# Build and test ASP.NET Core projects targeting .NET Core.
3+
# Add steps that run tests, create a NuGet package, deploy, and more:
4+
# https://docs.microsoft.com/azure/devops/pipelines/languages/dotnet-core
5+
6+
trigger:
7+
- master
8+
9+
pool:
10+
vmImage: "vs2017-win2016"
11+
steps:
12+
- task: DotNetCoreCLI@2
13+
displayName: "dotnet restore"
14+
inputs:
15+
command: restore
16+
projects: |
17+
src/**/*.csproj
18+
tests/**/*.csproj
19+
20+
- task: DotNetCoreCLI@2
21+
displayName: "dotnet build"
22+
inputs:
23+
projects: "src/**/*.csproj"
24+
25+
- task: DotNetCoreCLI@2
26+
displayName: "dotnet test"
27+
inputs:
28+
command: test
29+
projects: "tests/**/*.csproj"
30+
31+
- task: DotNetCoreCLI@2
32+
displayName: "dotnet pack"
33+
inputs:
34+
command: pack
35+
packagesToPack: "src/**/*.csproj"
36+
37+
- task: PublishBuildArtifacts@1
38+
displayName: "Publish Artifact: packages"
39+
inputs:
40+
ArtifactName: packages
Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,44 @@
11
using DDDToolkit.ApplicationLayer;
22
using DDDToolkit.Samples.Library.Domain;
3-
using System;
43
using System.Collections.Generic;
5-
using System.Text;
64
using DDDToolkit.ApplicationLayer.Transactions;
5+
using FluentQueries;
6+
using System.Threading.Tasks;
7+
using DDDToolkit.ApplicationLayer.Repositories;
8+
using System;
79

810
namespace DDDToolkit.Samples.Library.Application
911
{
10-
public class BookService : ApplicationService<Book, int>
12+
public class BookService : ApplicationService
1113
{
14+
private readonly IRepository<Book, int> _bookRepository;
15+
1216
public BookService(IUnitOfWork unitOfWork) : base(unitOfWork)
1317
{
18+
_bookRepository = unitOfWork.Repository<Book, int>();
19+
}
20+
21+
public Task<IReadOnlyCollection<Book>> GetBooksByAuthor(string firstName, string lastName)
22+
{
23+
var authorHasName = new AuthorHasName(firstName, lastName);
24+
var query = Query<Book>.Has(b => b.Author).Satisfying(authorHasName);
25+
return _bookRepository.Query(query);
26+
}
27+
28+
public Task<Book> GetById(int id)
29+
{
30+
return _bookRepository.GetById(id);
31+
}
32+
33+
public Task<IReadOnlyCollection<Book>> GetAll()
34+
{
35+
return _bookRepository.Query();
36+
}
37+
38+
public async Task Add(Book book)
39+
{
40+
await _bookRepository.Add(book);
41+
await _unitOfWork.Save();
1442
}
1543
}
1644
}

samples/library/DDDToolkit.Samples.Library.Domain/DDDToolkit.Samples.Library.Domain.csproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
</PropertyGroup>
66

77
<ItemGroup>
8-
<PackageReference Include="Newtonsoft.Json" Version="10.0.3" />
8+
<PackageReference Include="FluentQueries" Version="1.1.1" />
9+
<PackageReference Include="Newtonsoft.Json" Version="12.0.1" />
910
</ItemGroup>
1011

1112
<ItemGroup>

samples/library/DDDToolkit.Samples.Library.Domain/ISBN.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,14 @@ namespace DDDToolkit.Samples.Library.Domain
77
{
88
public class ISBN : ValueObject
99
{
10-
private string _value;
10+
private readonly string _value;
1111
public string Value => _value;
1212

1313
protected ISBN() { }
1414

1515
[JsonConstructor]
1616
public ISBN(string value)
17-
{
18-
17+
{
1918
_value = value;
2019
}
2120

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
1-
using DDDToolkit.Querying;
1+
using FluentQueries;
22

33
namespace DDDToolkit.Samples.Library.Domain
44
{
55
public class AuthorHasFirstName : Query<Author>
66
{
7-
public AuthorHasFirstName() : base(Has(a => a.FirstName).Satisfying(x => !string.IsNullOrWhiteSpace(x)))
7+
public AuthorHasFirstName()
88
{
9+
Define(
10+
Has(a => a.FirstName)
11+
.Satisfying(x => !string.IsNullOrWhiteSpace(x))
12+
);
913
}
1014
}
1115
}
Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
1-
using DDDToolkit.Querying;
1+
using FluentQueries;
22

33
namespace DDDToolkit.Samples.Library.Domain
44
{
55
internal class AuthorHasLastName : Query<Author>
66
{
7-
public AuthorHasLastName() : base(Has(a => a.LastName).Satisfying(x => !string.IsNullOrWhiteSpace(x)))
7+
public AuthorHasLastName()
88
{
9+
Define(
10+
Has(a => a.LastName)
11+
.Satisfying(x => !string.IsNullOrWhiteSpace(x))
12+
);
913
}
1014
}
1115
}
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
using DDDToolkit.Querying;
1+
using FluentQueries;
22

33
namespace DDDToolkit.Samples.Library.Domain
44
{
55
public class AuthorHasName : Query<Author>
66
{
77
public AuthorHasName(string firstName, string lastName)
8-
: base(
9-
Has(a => a.FirstName)
8+
{
9+
Define(Has(a => a.FirstName)
1010
.EqualTo(firstName)
11-
.And()
11+
.And
1212
.Has(a => a.LastName)
13-
.EqualTo(lastName)
14-
) { }
13+
.EqualTo(lastName));
14+
}
1515
}
1616
}

samples/library/DDDToolkit.Samples.Library.Domain/Validation/BookValidator.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
using DDDToolkit.Validation;
2-
using DDDToolkit.Querying;
32
using DDDToolkit.Samples.Library.Domain.Validation;
4-
using System;
3+
using FluentQueries;
54

65
namespace DDDToolkit.Samples.Library.Domain
76
{
@@ -16,7 +15,7 @@ public BookValidator()
1615
.HasRule<AuthorHasFirstName>()
1716
.HasRule<AuthorHasLastName>();
1817
Property(b => b.Title)
19-
.HasRule(Query<string>.Is.Satisfying(s => !string.IsNullOrEmpty(s)), "Title is required");
18+
.HasRule(Query<string>.Is.NotNullOrEmpty(), "Title is required");
2019
}
2120
}
2221
}
Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
1-
using DDDToolkit.Querying;
2-
using System;
3-
using System.Collections.Generic;
4-
using System.Text;
5-
using System.Linq.Expressions;
6-
using System.Text.RegularExpressions;
1+
using System.Text.RegularExpressions;
2+
using FluentQueries;
73

84
namespace DDDToolkit.Samples.Library.Domain.Validation
95
{
106
public class IsbnIsNumeric : Query<ISBN>
117
{
12-
public IsbnIsNumeric() :
13-
base(Has(i => i.Value).Satisfying(i => Regex.IsMatch(i, @"^\d+$")))
8+
public IsbnIsNumeric()
149
{
10+
Define(
11+
Has(i => i.Value)
12+
.Satisfying(i => Regex.IsMatch(i, @"^\d+$"))
13+
);
1514
}
1615
}
1716
}
Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
1-
using DDDToolkit.Querying;
2-
using System;
3-
using System.Collections.Generic;
4-
using System.Text;
5-
using System.Linq.Expressions;
1+
using FluentQueries;
62

73
namespace DDDToolkit.Samples.Library.Domain.Validation
84
{
95
public class IsbnIsOfValidLength : Query<ISBN>
106
{
11-
public IsbnIsOfValidLength()
12-
: base(Has(i => i.Value.Length)
13-
.EqualToAnyOf(10, 13))
7+
public IsbnIsOfValidLength()
148
{
9+
Define(
10+
Has(i => i.Value.Length)
11+
.EqualToAnyOf(10, 13)
12+
);
1513
}
1614
}
1715
}

samples/library/DDDToolkit.Samples.Library.Repository.Sql/DDDToolkit.Samples.Library.Repository.Sql.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
</PropertyGroup>
66

77
<ItemGroup>
8-
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="2.0.1" />
8+
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="2.2.2" />
99
</ItemGroup>
1010

1111
<ItemGroup>

samples/library/DDDToolkit.Samples.Library.Repository.Sql/LibraryContext.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
using DDDToolkit.Samples.Library.Domain;
22
using Microsoft.EntityFrameworkCore;
3-
using System;
4-
using System.Collections.Generic;
5-
using System.Text;
63

74
namespace DDDToolkit.Samples.Library.Repository.Sql
85
{

samples/library/DDDToolkit.Samples.Library.UI.Web/ClientApp/components/CreateBook.tsx

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,6 @@ import { RouteComponentProps } from 'react-router';
33
import 'isomorphic-fetch';
44
import BookForm from './BookForm';
55

6-
declare module 'react' {
7-
class Fragment extends React.Component { }
8-
}
9-
10-
interface CreateBookProps {
11-
12-
}
13-
146
interface CreateBookState {
157
title: string,
168
firstName: string,
@@ -19,16 +11,13 @@ interface CreateBookState {
1911
[key: string]: string
2012
}
2113

22-
class CreateBook extends React.Component<RouteComponentProps<CreateBookProps>, CreateBookState> {
23-
constructor() {
24-
super();
25-
this.state = {
26-
title: '',
27-
firstName: '',
28-
lastName: '',
29-
isbn: ''
30-
}
31-
}
14+
class CreateBook extends React.Component<RouteComponentProps<{}> | undefined, CreateBookState> {
15+
state = {
16+
title: '',
17+
firstName: '',
18+
lastName: '',
19+
isbn: ''
20+
};
3221

3322
private handleSubmit = (e: React.FormEvent<HTMLFormElement>) => {
3423
e.preventDefault();

samples/library/DDDToolkit.Samples.Library.UI.Web/ClientApp/components/FetchData.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,10 @@ interface FetchDataExampleState {
77
loading: boolean;
88
}
99

10-
export class FetchData extends React.Component<RouteComponentProps<{}>, FetchDataExampleState> {
11-
constructor() {
12-
super();
13-
this.state = { books: [], loading: true };
10+
export class FetchData extends React.Component<RouteComponentProps<any> | undefined, FetchDataExampleState> {
11+
state = { books: [], loading: true };
1412

13+
componentDidMount() {
1514
fetch('api/Book')
1615
.then(response => response.json() as Promise<Book[]>)
1716
.then(data => {

0 commit comments

Comments
 (0)