Skip to content

Commit

Permalink
Feature/caching repositories (#138)
Browse files Browse the repository at this point in the history
* Cleaning up persistence fluent DI interface so that we can expand for persistence caching. Deprecated old interface. Unit of work is now separate from persistence.

* Removed support for .NET 7.

* Added caching examples.

*  Updated RCommon solution to include new persistence caching providers.

* Updated build to include new packages.

* Updated dependencies to latest. Removed unused references.

* Re-worked datastore registration and corresponding factory so that we can allow a common connection string across multiple base types.

* Moved command and query models to Models project as that is more appropriate. This makes RCommon.Models a dependency of RCommon.ApplicationServices but this is probably the way in needs to be moving forward.

* Converted models to immutable records.

* Cleaned up caching persistence boostrapping.

---------
  • Loading branch information
JasonMWebb authored Oct 30, 2024
1 parent 4aca138 commit ea755a6
Show file tree
Hide file tree
Showing 193 changed files with 3,667 additions and 877 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ jobs:
name: ubuntu-latest
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: 'Cache: .nuke/temp, ~/.nuget/packages'
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: |
.nuke/temp
Expand Down
145 changes: 73 additions & 72 deletions .nuke/build.schema.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,74 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"$ref": "#/definitions/build",
"title": "Build Schema",
"properties": {
"CI": {
"type": "boolean"
},
"Configuration": {
"type": "string",
"description": "Configuration to build - Default is 'Debug' (local) or 'Release' (server)",
"enum": [
"Debug",
"Release"
]
},
"NUGETAPIKEY": {
"type": "string",
"default": "Secrets must be entered via 'nuke :secrets [profile]'"
},
"NuGetApiUrl": {
"type": "string"
},
"Solution": {
"type": "string",
"description": "Path to a solution file that is automatically loaded"
}
},
"definitions": {
"build": {
"type": "object",
"Host": {
"type": "string",
"enum": [
"AppVeyor",
"AzurePipelines",
"Bamboo",
"Bitbucket",
"Bitrise",
"GitHubActions",
"GitLab",
"Jenkins",
"Rider",
"SpaceAutomation",
"TeamCity",
"Terminal",
"TravisCI",
"VisualStudio",
"VSCode"
]
},
"ExecutableTarget": {
"type": "string",
"enum": [
"Clean",
"Compile",
"Pack",
"Print",
"Print_Net_SDK",
"Push",
"Restore"
]
},
"Verbosity": {
"type": "string",
"description": "",
"enum": [
"Verbose",
"Normal",
"Minimal",
"Quiet"
]
},
"NukeBuild": {
"properties": {
"CI": {
"type": "boolean"
},
"Configuration": {
"type": "string",
"description": "Configuration to build - Default is 'Debug' (local) or 'Release' (server)",
"enum": [
"Debug",
"Release"
]
},
"Continue": {
"type": "boolean",
"description": "Indicates to continue a previously failed build attempt"
Expand All @@ -26,37 +78,13 @@
"description": "Shows the help text for this build assembly"
},
"Host": {
"type": "string",
"description": "Host for execution. Default is 'automatic'",
"enum": [
"AppVeyor",
"AzurePipelines",
"Bamboo",
"Bitbucket",
"Bitrise",
"GitHubActions",
"GitLab",
"Jenkins",
"Rider",
"SpaceAutomation",
"TeamCity",
"Terminal",
"TravisCI",
"VisualStudio",
"VSCode"
]
"$ref": "#/definitions/Host"
},
"NoLogo": {
"type": "boolean",
"description": "Disables displaying the NUKE logo"
},
"NUGETAPIKEY": {
"type": "string",
"default": "Secrets must be entered via 'nuke :secrets [profile]'"
},
"NuGetApiUrl": {
"type": "string"
},
"Partition": {
"type": "string",
"description": "Partition to use on CI"
Expand All @@ -80,49 +108,22 @@
"type": "array",
"description": "List of targets to be skipped. Empty list skips all dependencies",
"items": {
"type": "string",
"enum": [
"Clean",
"Compile",
"Pack",
"Print",
"Print_Net_SDK",
"Push",
"Restore"
]
"$ref": "#/definitions/ExecutableTarget"
}
},
"Solution": {
"type": "string",
"description": "Path to a solution file that is automatically loaded"
},
"Target": {
"type": "array",
"description": "List of targets to be invoked. Default is '{default_target}'",
"items": {
"type": "string",
"enum": [
"Clean",
"Compile",
"Pack",
"Print",
"Print_Net_SDK",
"Push",
"Restore"
]
"$ref": "#/definitions/ExecutableTarget"
}
},
"Verbosity": {
"type": "string",
"description": "Logging verbosity during build execution. Default is 'Normal'",
"enum": [
"Minimal",
"Normal",
"Quiet",
"Verbose"
]
"$ref": "#/definitions/Verbosity"
}
}
}
}
},
"$ref": "#/definitions/NukeBuild"
}
164 changes: 163 additions & 1 deletion Build/Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ protected override void OnBuildInitialized()
{
Log.Information("Generating NuGet packages for projects in solution");
int commitNum = 0;
string NuGetVersionCustom = "2.0.0.885";
string NuGetVersionCustom = "2.1.0";


//if it's not a tagged release - append the commit number to the package version
Expand Down Expand Up @@ -483,6 +483,168 @@ protected override void OnBuildInitialized()
.SetOutputDirectory(Directory_NuGet)
.EnableNoBuild()
.EnableNoRestore());
DotNetTasks
.DotNetPack(_ => _
.SetPackageId("RCommon.Caching")
.SetProject(projects.FirstOrDefault(x => x.Name == "RCommon.Caching").Path.ToString())
.SetPackageTags("RCommon Caching abstractions")
.SetDescription("A cohesive set of infrastructure libraries for dotnet that utilizes abstractions for event handling persistence unit of work mediator distributed messaging event bus CQRS email and more")
.SetConfiguration(Configuration)
.SetCopyright(Copyright)
.SetAuthors("Jason Webb")
.SetPackageIconUrl("https://avatars.githubusercontent.com/u/96881178?s=200&v=4")
.SetRepositoryUrl("https://github.com/RCommon-Team/RCommon")
.SetPackageProjectUrl("https://rcommon.com")
.SetPackageLicenseUrl("https://licenses.nuget.org/Apache-2.0")
.SetVersion(NuGetVersionCustom)
.SetNoDependencies(true)
.SetOutputDirectory(Directory_NuGet)
.EnableNoBuild()
.EnableNoRestore());
DotNetTasks
.DotNetPack(_ => _
.SetPackageId("RCommon.Persistence.Caching")
.SetProject(projects.FirstOrDefault(x => x.Name == "RCommon.Persistence.Caching").Path.ToString())
.SetPackageTags("RCommon Persistence Caching Data Cache")
.SetDescription("A cohesive set of infrastructure libraries for dotnet that utilizes abstractions for event handling persistence unit of work mediator distributed messaging event bus CQRS email and more")
.SetConfiguration(Configuration)
.SetCopyright(Copyright)
.SetAuthors("Jason Webb")
.SetPackageIconUrl("https://avatars.githubusercontent.com/u/96881178?s=200&v=4")
.SetRepositoryUrl("https://github.com/RCommon-Team/RCommon")
.SetPackageProjectUrl("https://rcommon.com")
.SetPackageLicenseUrl("https://licenses.nuget.org/Apache-2.0")
.SetVersion(NuGetVersionCustom)
.SetNoDependencies(true)
.SetOutputDirectory(Directory_NuGet)
.EnableNoBuild()
.EnableNoRestore());
DotNetTasks
.DotNetPack(_ => _
.SetPackageId("RCommon.Persistence.Caching.MemoryCache")
.SetProject(projects.FirstOrDefault(x => x.Name == "RCommon.Persistence.Caching.MemoryCache").Path.ToString())
.SetPackageTags("RCommon Persistence Caching Memory InMemory")
.SetDescription("A cohesive set of infrastructure libraries for dotnet that utilizes abstractions for event handling persistence unit of work mediator distributed messaging event bus CQRS email and more")
.SetConfiguration(Configuration)
.SetCopyright(Copyright)
.SetAuthors("Jason Webb")
.SetPackageIconUrl("https://avatars.githubusercontent.com/u/96881178?s=200&v=4")
.SetRepositoryUrl("https://github.com/RCommon-Team/RCommon")
.SetPackageProjectUrl("https://rcommon.com")
.SetPackageLicenseUrl("https://licenses.nuget.org/Apache-2.0")
.SetVersion(NuGetVersionCustom)
.SetNoDependencies(true)
.SetOutputDirectory(Directory_NuGet)
.EnableNoBuild()
.EnableNoRestore());
DotNetTasks
.DotNetPack(_ => _
.SetPackageId("RCommon.Persistence.Caching.RedisCache")
.SetProject(projects.FirstOrDefault(x => x.Name == "RCommon.Persistence.Caching.RedisCache").Path.ToString())
.SetPackageTags("RCommon Persistence Caching Redis Cache StackExchange")
.SetDescription("A cohesive set of infrastructure libraries for dotnet that utilizes abstractions for event handling persistence unit of work mediator distributed messaging event bus CQRS email and more")
.SetConfiguration(Configuration)
.SetCopyright(Copyright)
.SetAuthors("Jason Webb")
.SetPackageIconUrl("https://avatars.githubusercontent.com/u/96881178?s=200&v=4")
.SetRepositoryUrl("https://github.com/RCommon-Team/RCommon")
.SetPackageProjectUrl("https://rcommon.com")
.SetPackageLicenseUrl("https://licenses.nuget.org/Apache-2.0")
.SetVersion(NuGetVersionCustom)
.SetNoDependencies(true)
.SetOutputDirectory(Directory_NuGet)
.EnableNoBuild()
.EnableNoRestore());
DotNetTasks
.DotNetPack(_ => _
.SetPackageId("RCommon.RedisCache")
.SetProject(projects.FirstOrDefault(x => x.Name == "RCommon.RedisCache").Path.ToString())
.SetPackageTags("RCommon Caching Redis Cache StackExchange")
.SetDescription("A cohesive set of infrastructure libraries for dotnet that utilizes abstractions for event handling persistence unit of work mediator distributed messaging event bus CQRS email and more")
.SetConfiguration(Configuration)
.SetCopyright(Copyright)
.SetAuthors("Jason Webb")
.SetPackageIconUrl("https://avatars.githubusercontent.com/u/96881178?s=200&v=4")
.SetRepositoryUrl("https://github.com/RCommon-Team/RCommon")
.SetPackageProjectUrl("https://rcommon.com")
.SetPackageLicenseUrl("https://licenses.nuget.org/Apache-2.0")
.SetVersion(NuGetVersionCustom)
.SetNoDependencies(true)
.SetOutputDirectory(Directory_NuGet)
.EnableNoBuild()
.EnableNoRestore());
DotNetTasks
.DotNetPack(_ => _
.SetPackageId("RCommon.MemoryCache")
.SetProject(projects.FirstOrDefault(x => x.Name == "RCommon.MemoryCache").Path.ToString())
.SetPackageTags("RCommon Caching Memory Cache InMemory Distributed Memory")
.SetDescription("A cohesive set of infrastructure libraries for dotnet that utilizes abstractions for event handling persistence unit of work mediator distributed messaging event bus CQRS email and more")
.SetConfiguration(Configuration)
.SetCopyright(Copyright)
.SetAuthors("Jason Webb")
.SetPackageIconUrl("https://avatars.githubusercontent.com/u/96881178?s=200&v=4")
.SetRepositoryUrl("https://github.com/RCommon-Team/RCommon")
.SetPackageProjectUrl("https://rcommon.com")
.SetPackageLicenseUrl("https://licenses.nuget.org/Apache-2.0")
.SetVersion(NuGetVersionCustom)
.SetNoDependencies(true)
.SetOutputDirectory(Directory_NuGet)
.EnableNoBuild()
.EnableNoRestore());
DotNetTasks
.DotNetPack(_ => _
.SetPackageId("RCommon.Json")
.SetProject(projects.FirstOrDefault(x => x.Name == "RCommon.Json").Path.ToString())
.SetPackageTags("RCommon Json serialization abstractions")
.SetDescription("A cohesive set of infrastructure libraries for dotnet that utilizes abstractions for event handling persistence unit of work mediator distributed messaging event bus CQRS email and more")
.SetConfiguration(Configuration)
.SetCopyright(Copyright)
.SetAuthors("Jason Webb")
.SetPackageIconUrl("https://avatars.githubusercontent.com/u/96881178?s=200&v=4")
.SetRepositoryUrl("https://github.com/RCommon-Team/RCommon")
.SetPackageProjectUrl("https://rcommon.com")
.SetPackageLicenseUrl("https://licenses.nuget.org/Apache-2.0")
.SetVersion(NuGetVersionCustom)
.SetNoDependencies(true)
.SetOutputDirectory(Directory_NuGet)
.EnableNoBuild()
.EnableNoRestore());
DotNetTasks
.DotNetPack(_ => _
.SetPackageId("RCommon.JsonNet")
.SetProject(projects.FirstOrDefault(x => x.Name == "RCommon.JsonNet").Path.ToString())
.SetPackageTags("RCommon Newtonsoft Json.NET serilization ")
.SetDescription("A cohesive set of infrastructure libraries for dotnet that utilizes abstractions for event handling persistence unit of work mediator distributed messaging event bus CQRS email and more")
.SetConfiguration(Configuration)
.SetCopyright(Copyright)
.SetAuthors("Jason Webb")
.SetPackageIconUrl("https://avatars.githubusercontent.com/u/96881178?s=200&v=4")
.SetRepositoryUrl("https://github.com/RCommon-Team/RCommon")
.SetPackageProjectUrl("https://rcommon.com")
.SetPackageLicenseUrl("https://licenses.nuget.org/Apache-2.0")
.SetVersion(NuGetVersionCustom)
.SetNoDependencies(true)
.SetOutputDirectory(Directory_NuGet)
.EnableNoBuild()
.EnableNoRestore());
DotNetTasks
.DotNetPack(_ => _
.SetPackageId("RCommon.SystemTextJson")
.SetProject(projects.FirstOrDefault(x => x.Name == "RCommon.SystemTextJson").Path.ToString())
.SetPackageTags("RCommon System.Text.Json serialization")
.SetDescription("A cohesive set of infrastructure libraries for dotnet that utilizes abstractions for event handling persistence unit of work mediator distributed messaging event bus CQRS email and more")
.SetConfiguration(Configuration)
.SetCopyright(Copyright)
.SetAuthors("Jason Webb")
.SetPackageIconUrl("https://avatars.githubusercontent.com/u/96881178?s=200&v=4")
.SetRepositoryUrl("https://github.com/RCommon-Team/RCommon")
.SetPackageProjectUrl("https://rcommon.com")
.SetPackageLicenseUrl("https://licenses.nuget.org/Apache-2.0")
.SetVersion(NuGetVersionCustom)
.SetNoDependencies(true)
.SetOutputDirectory(Directory_NuGet)
.EnableNoBuild()
.EnableNoRestore());
});


Expand Down
4 changes: 2 additions & 2 deletions Build/Build.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="6.0.1" />
<PackageReference Include="Nuke.Common" Version="8.0.0" />
<PackageReference Include="Nuke.GitHub" Version="5.0.1" />
<PackageReference Include="Nuke.Common" Version="8.1.2" />
<PackageReference Include="Nuke.GitHub" Version="6.0.0" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using RCommon.ApplicationServices.ExecutionResults;
using RCommon.Models.ExecutionResults;

namespace Examples.ApplicationServices.CQRS
{
Expand Down
Loading

0 comments on commit ea755a6

Please sign in to comment.