Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
55 changes: 23 additions & 32 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
release:
types:
- published

env:
# Stop wasting time caching packages
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
Expand All @@ -15,42 +15,33 @@ env:
GITHUB_FEED: https://nuget.pkg.github.com/koenbeuk/
GITHUB_USER: koenbeuk
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

jobs:
build:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
version: [1, 2, 3]
include:
- version: 1
configuration: ReleaseV1
- version: 2
configuration: ReleaseV2
- version: 3
configuration: Release
runs-on: ${{ matrix.os }}
runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
uses: actions/setup-dotnet@v4
with:
dotnet-version: 6.0.x
include-prerelease: True
global-json-file: global.json
- name: Install dependencies
run: dotnet restore EntityFrameworkCore.Triggered.sln -p:Configuration=${{ matrix.configuration }}
run: dotnet restore EntityFrameworkCore.Triggered.sln -p:Configuration=Release
- name: Build
run: dotnet build --configuration ${{ matrix.configuration }} --no-restore EntityFrameworkCore.Triggered.sln
run: dotnet build --configuration Release --no-restore EntityFrameworkCore.Triggered.sln
- name: Test
run: dotnet test --configuration ${{ matrix.configuration }} --verbosity normal EntityFrameworkCore.Triggered.sln
run: dotnet test --configuration Release --verbosity normal EntityFrameworkCore.Triggered.sln
- name: Pack
if: matrix.os == 'ubuntu-latest'
run: |
dotnet pack -v normal --configuration ${{ matrix.configuration }} --include-symbols --include-source -p:PackageVersion=${{ matrix.version }}-pre-$GITHUB_RUN_ID -o nupkg EntityFrameworkCore.Triggered.Core.slnf
run: |
dotnet pack -v normal --configuration Release --include-symbols --include-source -p:PackageVersion=3-pre-$GITHUB_RUN_ID -o nupkg EntityFrameworkCore.Triggered.Core.slnf
- name: Upload Artifact
if: matrix.os == 'ubuntu-latest'
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: nupkg
path: ./nupkg/*.nupkg
Expand All @@ -59,32 +50,32 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
uses: actions/setup-dotnet@v4
with:
dotnet-version: 6.0.x
include-prerelease: True
global-json-file: global.json
- name: Install dependencies
run: dotnet restore EntityFrameworkCore.Triggered.Samples.slnf
- name: Build
run: dotnet build --configuration Release --no-restore EntityFrameworkCore.Triggered.Samples.slnf
run: dotnet build --configuration Release --no-restore EntityFrameworkCore.Triggered.Samples.slnf

prerelease:
needs: build
if: github.ref == 'refs/heads/master'
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
steps:
- name: Download Artifact
uses: actions/download-artifact@v1
uses: actions/download-artifact@v4
with:
name: nupkg
path: nupkg
- name: Push to GitHub Feed
run: |
for f in ./nupkg/*.nupkg
do
dotnet nuget push $f --source $GITHUB_FEED --api-key ${{github.token}} --skip-duplicate --no-symbols
done
done
17 changes: 7 additions & 10 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ on:
release:
types:
- published

env:
# Stop wasting time caching packages
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
Expand All @@ -16,27 +16,24 @@ env:
# Official NuGet Feed settings
NUGET_FEED: https://api.nuget.org/v3/index.json
NUGET_KEY: ${{ secrets.NUGET_KEY }}

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
uses: actions/setup-dotnet@v4
with:
dotnet-version: 6.0.x
global-json-file: global.json
- name: Create Release NuGet package
run: |
arrTag=(${GITHUB_REF//\// })
VERSION="${arrTag[2]}"
echo Version: $VERSION
CONFIGURATION=$([ "${VERSION:0:2}" == "v1" ] && echo "ReleaseV1" || echo "Release")
CONFIGURATION=$([ "${VERSION:0:2}" == "v2" ] && echo "ReleaseV2" || echo $CONFIGURATION)
VERSION="${VERSION:1}"
echo Clean Version: $VERSION
echo Configuration: $CONFIGURATION
dotnet pack -v normal -c $CONFIGURATION --include-symbols --include-source -p:PackageVersion=$VERSION -o nupkg EntityFrameworkCore.Triggered.Core.slnf
dotnet pack -v normal -c Release --include-symbols --include-source -p:PackageVersion=$VERSION -o nupkg EntityFrameworkCore.Triggered.Core.slnf
- name: Push to GitHub Feed
run: |
for f in ./nupkg/*.nupkg
Expand All @@ -48,4 +45,4 @@ jobs:
for f in ./nupkg/*.nupkg
do
dotnet nuget push $f --source $NUGET_FEED --skip-duplicate --api-key $NUGET_KEY
done
done
43 changes: 18 additions & 25 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,31 +1,24 @@
<Project>

<PropertyGroup>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<LangVersion>9.0</LangVersion>
<Nullable>enable</Nullable>
<EnableNETAnalyzers>true</EnableNETAnalyzers>
<Configurations>Debug;Release</Configurations>
<PackageReadmeFile>README.md</PackageReadmeFile>
</PropertyGroup>
<PropertyGroup>
<LangVersion>12</LangVersion>
<Nullable>enable</Nullable>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<EnableNETAnalyzers>true</EnableNETAnalyzers>
<PackageReadmeFile>README.md</PackageReadmeFile>
</PropertyGroup>

<PropertyGroup>
<Description>Triggers for EF Core. Respond to changes in your ApplicationDbContext before and after they are committed to the database</Description>
<RepositoryType>Git</RepositoryType>
<RepositoryUrl>https://github.com/koenbeuk/EntityFrameworkCore.Triggered</RepositoryUrl>
<Authors>Koen Bekkenutte</Authors>
<PackageTags>EntityFramework;EFCore;Triggers;SQLServer;SqlLite;CosmosDb;.NET Core;aspnetcore</PackageTags>
<PackageProjectUrl>https://github.com/koenbeuk/EntityFrameworkCore.Triggered</PackageProjectUrl>
</PropertyGroup>

<PropertyGroup>
<EFCoreTriggeredVersion>3</EFCoreTriggeredVersion>
<EFCorePackageVersion>6.0.0</EFCorePackageVersion>
<MicrosoftExtensionsVersion>6.0.0</MicrosoftExtensionsVersion>
</PropertyGroup>
<PropertyGroup>
<Description>Triggers for EF Core. Respond to changes in your ApplicationDbContext before and after they are committed to the database</Description>
<RepositoryType>Git</RepositoryType>
<RepositoryUrl>https://github.com/koenbeuk/EntityFrameworkCore.Triggered</RepositoryUrl>
<Authors>Koen Bekkenutte</Authors>
<PackageTags>EntityFramework;EFCore;Triggers;SQLServer;SqlLite;CosmosDb;.NET Core;aspnetcore</PackageTags>
<PackageProjectUrl>https://github.com/koenbeuk/EntityFrameworkCore.Triggered</PackageProjectUrl>
</PropertyGroup>

<ItemGroup>
<None Include="$(SolutionDir)\README.md" Pack="true" PackagePath="\"></None>
</ItemGroup>
<ItemGroup>
<None Include="$(SolutionDir)\README.md" Pack="true" PackagePath="\" />
</ItemGroup>

</Project>
33 changes: 33 additions & 0 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<Project>
<PropertyGroup>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
</PropertyGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net8.0'">
<PackageVersion Include="Microsoft.EntityFrameworkCore" Version="8.0.10" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.Sqlite" Version="8.0.10" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.InMemory" Version="8.0.10" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="8.0.10" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net9.0'">
<PackageVersion Include="Microsoft.EntityFrameworkCore" Version="9.0.0" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.Sqlite" Version="9.0.0" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.InMemory" Version="9.0.0" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="9.0.0" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net10.0'">
<PackageVersion Include="Microsoft.EntityFrameworkCore" Version="10.0.0" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.Sqlite" Version="10.0.0" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.InMemory" Version="10.0.0" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="10.0.0" />
</ItemGroup>
<ItemGroup>
<PackageVersion Include="BenchmarkDotNet" Version="0.15.8" />
<PackageVersion Include="coverlet.collector" Version="8.0.1" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="18.3.0" />
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="8.0.0" />
<PackageVersion Include="Verify.Xunit" Version="31.12.5" />
<PackageVersion Include="xunit" Version="2.9.3" />
<PackageVersion Include="xunit.runner.visualstudio" Version="3.1.5" />
<PackageVersion Include="ScenarioTests.XUnit" Version="1.0.1" />
</ItemGroup>
</Project>
17 changes: 17 additions & 0 deletions EntityFrameworkCore.Triggered.sln
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,23 @@ Microsoft Visual Studio Solution File, Format Version 12.00
VisualStudioVersion = 17.0.31710.8
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{EDFABD48-3C79-47AE-B84C-47CE2A52C20D}"
ProjectSection(SolutionItems) = preProject
src\Directory.Build.props = src\Directory.Build.props
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{0FAE4F6A-93BB-453C-8FB4-B24A9F30DA59}"
ProjectSection(SolutionItems) = preProject
test\Directory.Build.props = test\Directory.Build.props
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "_Solution Items", "_Solution Items", "{CA7737C4-0D3C-4B81-B34C-B4812B54C018}"
ProjectSection(SolutionItems) = preProject
.editorconfig = .editorconfig
Directory.Build.props = Directory.Build.props
LICENSE.md = LICENSE.md
README.md = README.md
Directory.Packages.props = Directory.Packages.props
global.json = global.json
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EntityFrameworkCore.Triggered.Abstractions", "src\EntityFrameworkCore.Triggered.Abstractions\EntityFrameworkCore.Triggered.Abstractions.csproj", "{B338AEB6-4D18-4069-AE00-9A1E33C638F4}"
Expand Down Expand Up @@ -47,6 +55,14 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "3 - StudentManagerAspNetCor
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "4 - BlazorTests", "samples\4 - BlazorTests\4 - BlazorTests.csproj", "{C764B357-8ABE-483E-BA1D-EC05ED689691}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "_Github", "_Github", "{BCBB4711-7968-44C0-81BD-C848FF4FBAB8}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{46951DC8-925A-4542-99FC-2C2B3E00A997}"
ProjectSection(SolutionItems) = preProject
.github\workflows\build.yml = .github\workflows\build.yml
.github\workflows\release.yml = .github\workflows\release.yml
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -244,6 +260,7 @@ Global
{6139FBAB-0224-42ED-8DAF-54ED1F3E8C5B} = {FB5C3BC0-5036-4DD6-85E2-E2B05ECAC40C}
{6D1D3A38-523A-44A8-A3F9-B78E34706B37} = {FB5C3BC0-5036-4DD6-85E2-E2B05ECAC40C}
{C764B357-8ABE-483E-BA1D-EC05ED689691} = {FB5C3BC0-5036-4DD6-85E2-E2B05ECAC40C}
{46951DC8-925A-4542-99FC-2C2B3E00A997} = {BCBB4711-7968-44C0-81BD-C848FF4FBAB8}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {847A0017-23D6-4513-B78E-CAADBD836A7D}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<OutputType>Exe</OutputType>
</PropertyGroup>
<PropertyGroup>
Expand All @@ -12,8 +12,8 @@
<Configuration>Release</Configuration>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="BenchmarkDotNet" Version="0.12.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="6.0.0-rc.1.21452.10" />
<PackageReference Include="BenchmarkDotNet" />
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\EntityFrameworkCore.Triggered\EntityFrameworkCore.Triggered.csproj" />
Expand Down
6 changes: 6 additions & 0 deletions global.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"sdk": {
"version": "10.0.100",
"rollForward": "latestMinor"
}
}
29 changes: 16 additions & 13 deletions samples/1 - HelloWorld/1 - HelloWorld.csproj
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<RootNamespace>HelloWorld</RootNamespace>
<Nullable>disable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="EntityFrameworkCore.Triggered" Version="$(EFCoreTriggeredPackageVersion)" />
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="$(EFCorePackageVersion)" />
</ItemGroup>

</Project>
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net10.0</TargetFramework>
<RootNamespace>HelloWorld</RootNamespace>
<Nullable>disable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\EntityFrameworkCore.Triggered\EntityFrameworkCore.Triggered.csproj" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@

namespace PrimarySchool.Triggers
{
public class StudentAssignRegistrationDate : IBeforeSaveTrigger<Student>
public class StudentAssignRegistrationDate : IBeforeSaveAsyncTrigger<Student>
{
public Task BeforeSave(ITriggerContext<Student> context, CancellationToken cancellationToken)
public Task BeforeSaveAsync(ITriggerContext<Student> context, CancellationToken cancellationToken)
{
if (context.ChangeType == ChangeType.Added)
{
Expand Down
29 changes: 16 additions & 13 deletions samples/2 - PrimarySchool/2 - PrimarySchool.csproj
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk.Worker">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<RootNamespace>PrimarySchool</RootNamespace>
<Nullable>disable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="EntityFrameworkCore.Triggered" Version="$(EFCoreTriggeredPackageVersion)" />
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="$(EFCorePackageVersion)" />
</ItemGroup>

</Project>
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net10.0</TargetFramework>
<RootNamespace>PrimarySchool</RootNamespace>
<Nullable>disable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\EntityFrameworkCore.Triggered\EntityFrameworkCore.Triggered.csproj" />
</ItemGroup>

</Project>
Loading
Loading