Skip to content

v2 release #48

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 25 commits into from
Mar 2, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
2cfaa30
Allowing and/or without has and various syntax changes
codepb Feb 17, 2019
cbc635e
Broken, but further tweaks to syntax
codepb Feb 17, 2019
2926382
Simplifying, updating nuget packages, and adding string extensions
codepb Feb 18, 2019
8ba466e
adding enumerable extensions and fixing satisfying and null to continue
codepb Feb 19, 2019
e45af1e
Adding SequenceEqual
codepb Feb 19, 2019
acb3618
Adding boolean extensions
codepb Feb 20, 2019
33d4d85
moved querying to separate repository and updated to use "FluentQueri…
codepb Feb 24, 2019
e518d55
Adding paging options and changing names of some repository methods
codepb Feb 24, 2019
f6554b2
updating validator method names
codepb Feb 24, 2019
35ee0df
removing api, and simplifying application services
codepb Feb 27, 2019
69cf257
Reworking repository layer to be simpler. Added QueryOptions to repos…
codepb Mar 1, 2019
f86b212
Refactoring unitOfWork to use an object resolver and adding transacti…
codepb Mar 2, 2019
a4539f0
Allowing custom registration of repositories
codepb Mar 2, 2019
8f71265
Moving event sourcing to separate project and updating nuget packages…
codepb Mar 2, 2019
b637e14
removing old project, moving new projects, using license file
codepb Mar 2, 2019
f731b63
adding build file
codepb Mar 2, 2019
846a268
fixing issues with npm build
codepb Mar 2, 2019
4de586d
fixing errors with routing
codepb Mar 2, 2019
1ccd5c5
updating build to use vs image
codepb Mar 2, 2019
a57dd1a
just building src
codepb Mar 2, 2019
d6165fc
updating build
codepb Mar 2, 2019
77df165
removing build file
codepb Mar 2, 2019
71f64e1
adding back in pipelines file
codepb Mar 2, 2019
8030f29
updated vmimage
codepb Mar 2, 2019
37829a5
Merge pull request #47 from codepb/v2
codepb Mar 2, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 13 additions & 20 deletions DDDToolkit.sln
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{57967491
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DDDToolkit.Core.Tests", "tests\DDDToolkit.Core.Tests\DDDToolkit.Core.Tests.csproj", "{4E33A86B-6589-4501-A43A-F5A9E31AD35F}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DDDToolkit.API", "src\DDDToolkit.API\DDDToolkit.API.csproj", "{12926EE6-E9DF-4143-B1B6-016F9DE490DA}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DDDToolkit.Utilities", "src\DDDToolkit.Utilities\DDDToolkit.Utilities.csproj", "{0E06C087-FF39-4382-910C-2EC303FC4DA0}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DDDToolkit.EntityFramework.Extensions", "src\DDDToolkit.EntityFramework.Extensions\DDDToolkit.EntityFramework.Extensions.csproj", "{6F2563E8-BCF6-4751-9B23-4CE8426CFE42}"
Expand All @@ -35,11 +33,11 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DDDToolkit.Samples.Library.
EndProject
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}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DDDToolkit.Querying", "src\DDDToolkit.Querying\DDDToolkit.Querying.csproj", "{AAAF943F-C3DE-4BD5-BC2D-850E77A9B607}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DDDToolkit.Validation", "src\DDDToolkit.Validation\DDDToolkit.Validation.csproj", "{0D0A57EF-3B95-4D6B-A3E6-0217FEB0DC6F}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DDDToolkit.Querying.Tests", "tests\DDDToolkit.Querying.Tests\DDDToolkit.Querying.Tests.csproj", "{4D18A7F4-169C-4399-BFF3-F2F8AE665C55}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DDDToolkit.EventSourcing", "src\DDDToolkit.EventSourcing\DDDToolkit.EventSourcing.csproj", "{EE8BBDB2-9128-4C5C-9648-53371FE3C3BE}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DDDToolkit.Validation", "src\DDDToolkit.Validation\DDDToolkit.Validation.csproj", "{0D0A57EF-3B95-4D6B-A3E6-0217FEB0DC6F}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DDDToolkit.EventSourcing.Tests", "tests\DDDToolkit.EventSourcing.Tests\DDDToolkit.EventSourcing.Tests.csproj", "{37BE5ED1-05A9-491B-B8DA-F751882E20B0}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand All @@ -63,10 +61,6 @@ Global
{4E33A86B-6589-4501-A43A-F5A9E31AD35F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4E33A86B-6589-4501-A43A-F5A9E31AD35F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4E33A86B-6589-4501-A43A-F5A9E31AD35F}.Release|Any CPU.Build.0 = Release|Any CPU
{12926EE6-E9DF-4143-B1B6-016F9DE490DA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{12926EE6-E9DF-4143-B1B6-016F9DE490DA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{12926EE6-E9DF-4143-B1B6-016F9DE490DA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{12926EE6-E9DF-4143-B1B6-016F9DE490DA}.Release|Any CPU.Build.0 = Release|Any CPU
{0E06C087-FF39-4382-910C-2EC303FC4DA0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0E06C087-FF39-4382-910C-2EC303FC4DA0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0E06C087-FF39-4382-910C-2EC303FC4DA0}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand Down Expand Up @@ -97,18 +91,18 @@ Global
{1D41D8D2-B6A5-47DD-8E98-9512EC48B429}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1D41D8D2-B6A5-47DD-8E98-9512EC48B429}.Release|Any CPU.Build.0 = Release|Any CPU
{1D41D8D2-B6A5-47DD-8E98-9512EC48B429}.Release|Any CPU.Deploy.0 = Release|Any CPU
{AAAF943F-C3DE-4BD5-BC2D-850E77A9B607}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AAAF943F-C3DE-4BD5-BC2D-850E77A9B607}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AAAF943F-C3DE-4BD5-BC2D-850E77A9B607}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AAAF943F-C3DE-4BD5-BC2D-850E77A9B607}.Release|Any CPU.Build.0 = Release|Any CPU
{4D18A7F4-169C-4399-BFF3-F2F8AE665C55}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4D18A7F4-169C-4399-BFF3-F2F8AE665C55}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4D18A7F4-169C-4399-BFF3-F2F8AE665C55}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4D18A7F4-169C-4399-BFF3-F2F8AE665C55}.Release|Any CPU.Build.0 = Release|Any CPU
{0D0A57EF-3B95-4D6B-A3E6-0217FEB0DC6F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0D0A57EF-3B95-4D6B-A3E6-0217FEB0DC6F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0D0A57EF-3B95-4D6B-A3E6-0217FEB0DC6F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0D0A57EF-3B95-4D6B-A3E6-0217FEB0DC6F}.Release|Any CPU.Build.0 = Release|Any CPU
{EE8BBDB2-9128-4C5C-9648-53371FE3C3BE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{EE8BBDB2-9128-4C5C-9648-53371FE3C3BE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EE8BBDB2-9128-4C5C-9648-53371FE3C3BE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EE8BBDB2-9128-4C5C-9648-53371FE3C3BE}.Release|Any CPU.Build.0 = Release|Any CPU
{37BE5ED1-05A9-491B-B8DA-F751882E20B0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{37BE5ED1-05A9-491B-B8DA-F751882E20B0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{37BE5ED1-05A9-491B-B8DA-F751882E20B0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{37BE5ED1-05A9-491B-B8DA-F751882E20B0}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -118,7 +112,6 @@ Global
{C6748BFC-81EA-4C73-9B49-EC3534BDA722} = {EF054C6D-056E-417A-A40A-376A20DF90A6}
{849591EE-EEF6-4B29-97AA-34F532C2A642} = {EF054C6D-056E-417A-A40A-376A20DF90A6}
{4E33A86B-6589-4501-A43A-F5A9E31AD35F} = {57967491-B4BB-44B9-B270-6533A1E388B0}
{12926EE6-E9DF-4143-B1B6-016F9DE490DA} = {EF054C6D-056E-417A-A40A-376A20DF90A6}
{0E06C087-FF39-4382-910C-2EC303FC4DA0} = {EF054C6D-056E-417A-A40A-376A20DF90A6}
{6F2563E8-BCF6-4751-9B23-4CE8426CFE42} = {EF054C6D-056E-417A-A40A-376A20DF90A6}
{BDD881C3-118B-42D6-9D77-DDAB213CA4B0} = {175A537D-B6E1-4194-8895-D1870CF866E2}
Expand All @@ -127,9 +120,9 @@ Global
{95D67484-5CDD-4CA2-8457-B4A5D42D4D3C} = {BDD881C3-118B-42D6-9D77-DDAB213CA4B0}
{6DD4F5BC-B48B-43A6-A048-28F8BD04D7F6} = {BDD881C3-118B-42D6-9D77-DDAB213CA4B0}
{1D41D8D2-B6A5-47DD-8E98-9512EC48B429} = {BDD881C3-118B-42D6-9D77-DDAB213CA4B0}
{AAAF943F-C3DE-4BD5-BC2D-850E77A9B607} = {EF054C6D-056E-417A-A40A-376A20DF90A6}
{4D18A7F4-169C-4399-BFF3-F2F8AE665C55} = {57967491-B4BB-44B9-B270-6533A1E388B0}
{0D0A57EF-3B95-4D6B-A3E6-0217FEB0DC6F} = {EF054C6D-056E-417A-A40A-376A20DF90A6}
{EE8BBDB2-9128-4C5C-9648-53371FE3C3BE} = {EF054C6D-056E-417A-A40A-376A20DF90A6}
{37BE5ED1-05A9-491B-B8DA-F751882E20B0} = {57967491-B4BB-44B9-B270-6533A1E388B0}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {E3DCC906-DD65-4478-A617-AC943C719834}
Expand Down
40 changes: 40 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# ASP.NET Core
# Build and test ASP.NET Core projects targeting .NET Core.
# Add steps that run tests, create a NuGet package, deploy, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/dotnet-core

trigger:
- master

pool:
vmImage: "vs2017-win2016"
steps:
- task: DotNetCoreCLI@2
displayName: "dotnet restore"
inputs:
command: restore
projects: |
src/**/*.csproj
tests/**/*.csproj

- task: DotNetCoreCLI@2
displayName: "dotnet build"
inputs:
projects: "src/**/*.csproj"

- task: DotNetCoreCLI@2
displayName: "dotnet test"
inputs:
command: test
projects: "tests/**/*.csproj"

- task: DotNetCoreCLI@2
displayName: "dotnet pack"
inputs:
command: pack
packagesToPack: "src/**/*.csproj"

- task: PublishBuildArtifacts@1
displayName: "Publish Artifact: packages"
inputs:
ArtifactName: packages
Original file line number Diff line number Diff line change
@@ -1,16 +1,44 @@
using DDDToolkit.ApplicationLayer;
using DDDToolkit.Samples.Library.Domain;
using System;
using System.Collections.Generic;
using System.Text;
using DDDToolkit.ApplicationLayer.Transactions;
using FluentQueries;
using System.Threading.Tasks;
using DDDToolkit.ApplicationLayer.Repositories;
using System;

namespace DDDToolkit.Samples.Library.Application
{
public class BookService : ApplicationService<Book, int>
public class BookService : ApplicationService
{
private readonly IRepository<Book, int> _bookRepository;

public BookService(IUnitOfWork unitOfWork) : base(unitOfWork)
{
_bookRepository = unitOfWork.Repository<Book, int>();
}

public Task<IReadOnlyCollection<Book>> GetBooksByAuthor(string firstName, string lastName)
{
var authorHasName = new AuthorHasName(firstName, lastName);
var query = Query<Book>.Has(b => b.Author).Satisfying(authorHasName);
return _bookRepository.Query(query);
}

public Task<Book> GetById(int id)
{
return _bookRepository.GetById(id);
}

public Task<IReadOnlyCollection<Book>> GetAll()
{
return _bookRepository.Query();
}

public async Task Add(Book book)
{
await _bookRepository.Add(book);
await _unitOfWork.Save();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="10.0.3" />
<PackageReference Include="FluentQueries" Version="1.1.1" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.1" />
</ItemGroup>

<ItemGroup>
Expand Down
5 changes: 2 additions & 3 deletions samples/library/DDDToolkit.Samples.Library.Domain/ISBN.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,14 @@ namespace DDDToolkit.Samples.Library.Domain
{
public class ISBN : ValueObject
{
private string _value;
private readonly string _value;
public string Value => _value;

protected ISBN() { }

[JsonConstructor]
public ISBN(string value)
{

{
_value = value;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
using DDDToolkit.Querying;
using FluentQueries;

namespace DDDToolkit.Samples.Library.Domain
{
public class AuthorHasFirstName : Query<Author>
{
public AuthorHasFirstName() : base(Has(a => a.FirstName).Satisfying(x => !string.IsNullOrWhiteSpace(x)))
public AuthorHasFirstName()
{
Define(
Has(a => a.FirstName)
.Satisfying(x => !string.IsNullOrWhiteSpace(x))
);
}
}
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
using DDDToolkit.Querying;
using FluentQueries;

namespace DDDToolkit.Samples.Library.Domain
{
internal class AuthorHasLastName : Query<Author>
{
public AuthorHasLastName() : base(Has(a => a.LastName).Satisfying(x => !string.IsNullOrWhiteSpace(x)))
public AuthorHasLastName()
{
Define(
Has(a => a.LastName)
.Satisfying(x => !string.IsNullOrWhiteSpace(x))
);
}
}
}
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
using DDDToolkit.Querying;
using FluentQueries;

namespace DDDToolkit.Samples.Library.Domain
{
public class AuthorHasName : Query<Author>
{
public AuthorHasName(string firstName, string lastName)
: base(
Has(a => a.FirstName)
{
Define(Has(a => a.FirstName)
.EqualTo(firstName)
.And()
.And
.Has(a => a.LastName)
.EqualTo(lastName)
) { }
.EqualTo(lastName));
}
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using DDDToolkit.Validation;
using DDDToolkit.Querying;
using DDDToolkit.Samples.Library.Domain.Validation;
using System;
using FluentQueries;

namespace DDDToolkit.Samples.Library.Domain
{
Expand All @@ -16,7 +15,7 @@ public BookValidator()
.HasRule<AuthorHasFirstName>()
.HasRule<AuthorHasLastName>();
Property(b => b.Title)
.HasRule(Query<string>.Is.Satisfying(s => !string.IsNullOrEmpty(s)), "Title is required");
.HasRule(Query<string>.Is.NotNullOrEmpty(), "Title is required");
}
}
}
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
using DDDToolkit.Querying;
using System;
using System.Collections.Generic;
using System.Text;
using System.Linq.Expressions;
using System.Text.RegularExpressions;
using System.Text.RegularExpressions;
using FluentQueries;

namespace DDDToolkit.Samples.Library.Domain.Validation
{
public class IsbnIsNumeric : Query<ISBN>
{
public IsbnIsNumeric() :
base(Has(i => i.Value).Satisfying(i => Regex.IsMatch(i, @"^\d+$")))
public IsbnIsNumeric()
{
Define(
Has(i => i.Value)
.Satisfying(i => Regex.IsMatch(i, @"^\d+$"))
);
}
}
}
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
using DDDToolkit.Querying;
using System;
using System.Collections.Generic;
using System.Text;
using System.Linq.Expressions;
using FluentQueries;

namespace DDDToolkit.Samples.Library.Domain.Validation
{
public class IsbnIsOfValidLength : Query<ISBN>
{
public IsbnIsOfValidLength()
: base(Has(i => i.Value.Length)
.EqualToAnyOf(10, 13))
public IsbnIsOfValidLength()
{
Define(
Has(i => i.Value.Length)
.EqualToAnyOf(10, 13)
);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="2.0.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="2.2.2" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
using DDDToolkit.Samples.Library.Domain;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Text;

namespace DDDToolkit.Samples.Library.Repository.Sql
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,6 @@ import { RouteComponentProps } from 'react-router';
import 'isomorphic-fetch';
import BookForm from './BookForm';

declare module 'react' {
class Fragment extends React.Component { }
}

interface CreateBookProps {

}

interface CreateBookState {
title: string,
firstName: string,
Expand All @@ -19,16 +11,13 @@ interface CreateBookState {
[key: string]: string
}

class CreateBook extends React.Component<RouteComponentProps<CreateBookProps>, CreateBookState> {
constructor() {
super();
this.state = {
title: '',
firstName: '',
lastName: '',
isbn: ''
}
}
class CreateBook extends React.Component<RouteComponentProps<{}> | undefined, CreateBookState> {
state = {
title: '',
firstName: '',
lastName: '',
isbn: ''
};

private handleSubmit = (e: React.FormEvent<HTMLFormElement>) => {
e.preventDefault();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,10 @@ interface FetchDataExampleState {
loading: boolean;
}

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

componentDidMount() {
fetch('api/Book')
.then(response => response.json() as Promise<Book[]>)
.then(data => {
Expand Down
Loading