Skip to content

Updated to .NET 8 #208

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

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
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
76 changes: 76 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -131,3 +131,79 @@ dotnet_naming_symbols.instance_fields.applicable_kinds = field

dotnet_naming_style.instance_field_style.capitalization = camel_case
dotnet_naming_style.instance_field_style.required_prefix = _
csharp_indent_labels = one_less_than_current
csharp_using_directive_placement = outside_namespace:silent
csharp_prefer_simple_using_statement = true:suggestion
csharp_style_namespace_declarations = file_scoped:silent
csharp_style_prefer_method_group_conversion = true:silent
csharp_style_prefer_top_level_statements = true:silent
csharp_style_prefer_primary_constructors = true:suggestion
csharp_style_expression_bodied_operators = false:silent
csharp_style_expression_bodied_indexers = true:silent
csharp_style_expression_bodied_accessors = true:silent
csharp_style_expression_bodied_lambdas = true:silent
csharp_style_expression_bodied_local_functions = false:silent
csharp_style_throw_expression = true:suggestion
csharp_style_prefer_null_check_over_type_check = true:suggestion
csharp_space_around_binary_operators = before_and_after
csharp_style_prefer_local_over_anonymous_function = true:suggestion
csharp_style_prefer_index_operator = true:suggestion
csharp_style_prefer_range_operator = true:suggestion
csharp_style_implicit_object_creation_when_type_is_apparent = true:suggestion
csharp_style_prefer_tuple_swap = true:suggestion
csharp_style_prefer_utf8_string_literals = true:suggestion
csharp_style_inlined_variable_declaration = true:suggestion
csharp_style_deconstructed_variable_declaration = true:suggestion
csharp_style_unused_value_assignment_preference = discard_variable:suggestion
csharp_style_unused_value_expression_statement_preference = discard_variable:silent
csharp_style_prefer_readonly_struct = true:suggestion
csharp_prefer_static_local_function = true:suggestion
csharp_style_prefer_readonly_struct_member = true:suggestion
csharp_style_allow_embedded_statements_on_same_line_experimental = true:silent
csharp_style_allow_blank_lines_between_consecutive_braces_experimental = true:silent
csharp_style_allow_blank_line_after_colon_in_constructor_initializer_experimental = true:silent
csharp_style_allow_blank_line_after_token_in_conditional_expression_experimental = true:silent
csharp_style_allow_blank_line_after_token_in_arrow_expression_clause_experimental = true:silent
csharp_style_conditional_delegate_call = true:suggestion
csharp_style_prefer_switch_expression = true:suggestion
csharp_style_prefer_pattern_matching = true:silent
csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
csharp_style_prefer_not_pattern = true:suggestion
csharp_style_prefer_extended_property_pattern = true:suggestion

[*.{cs,vb}]
dotnet_style_operator_placement_when_wrapping = beginning_of_line
tab_width = 4
indent_size = 4
end_of_line = crlf
dotnet_style_coalesce_expression = true:suggestion
dotnet_style_null_propagation = true:suggestion
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion
dotnet_style_prefer_auto_properties = true:silent
dotnet_style_object_initializer = true:suggestion
dotnet_style_collection_initializer = true:suggestion
dotnet_style_prefer_simplified_boolean_expressions = true:suggestion
dotnet_style_prefer_conditional_expression_over_assignment = true:silent
dotnet_style_prefer_conditional_expression_over_return = true:silent
dotnet_style_explicit_tuple_names = true:suggestion
dotnet_style_prefer_inferred_tuple_names = true:suggestion
dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion
dotnet_style_prefer_compound_assignment = true:suggestion
dotnet_style_prefer_simplified_interpolation = true:suggestion
dotnet_style_prefer_collection_expression = when_types_loosely_match:suggestion
dotnet_style_namespace_match_folder = true:suggestion
dotnet_style_readonly_field = true:suggestion
dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion
dotnet_style_predefined_type_for_member_access = true:suggestion
dotnet_style_require_accessibility_modifiers = never:silent
dotnet_style_allow_multiple_blank_lines_experimental = true:silent
dotnet_style_allow_statement_immediately_after_block_experimental = true:silent
dotnet_code_quality_unused_parameters = all:suggestion
dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:silent
dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:silent
dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:silent
dotnet_style_parentheses_in_other_operators = never_if_unnecessary:silent
dotnet_style_qualification_for_field = false:suggestion
dotnet_style_qualification_for_property = false:suggestion
dotnet_style_qualification_for_method = false:suggestion
dotnet_style_qualification_for_event = false:silent
14 changes: 2 additions & 12 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,13 @@ jobs:
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 }}

steps:
- uses: actions/checkout@v2
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 6.0.x
include-prerelease: True
dotnet-version: 8.0.x
- name: Install dependencies
run: dotnet restore EntityFrameworkCore.Triggered.sln -p:Configuration=${{ matrix.configuration }}
- name: Build
Expand Down Expand Up @@ -66,7 +56,7 @@ jobs:
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 6.0.x
dotnet-version: 8.0.x
include-prerelease: True
- name: Install dependencies
run: dotnet restore EntityFrameworkCore.Triggered.Samples.slnf
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 6.0.x
dotnet-version: 8.0.x
- name: Create Release NuGet package
run: |
arrTag=(${GITHUB_REF//\// })
Expand Down
40 changes: 17 additions & 23 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,31 +1,25 @@
<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>
<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>
<TargetFramework>net8.0</TargetFramework>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<LangVersion>12.0</LangVersion>
<Nullable>enable</Nullable>
<EnableNETAnalyzers>true</EnableNETAnalyzers>
<PackageReadmeFile>README.md</PackageReadmeFile>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>

<PropertyGroup>
<EFCoreTriggeredVersion>3</EFCoreTriggeredVersion>
<EFCorePackageVersion>6.0.0</EFCorePackageVersion>
<MicrosoftExtensionsVersion>6.0.0</MicrosoftExtensionsVersion>
<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="\"></None>
</ItemGroup>
</Project>
18 changes: 18 additions & 0 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<Project>
<PropertyGroup>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
<CentralPackageTransitivePinningEnabled>false</CentralPackageTransitivePinningEnabled>
<NoWarn>$(NoWarn);NU1903</NoWarn>
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="BenchmarkDotNet" Version="0.13.12" />
<PackageVersion Include="Microsoft.EntityFrameworkCore" Version="8.0.0" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.InMemory" Version="8.0.10" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.Sqlite" Version="8.0.10" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
<PackageVersion Include="ScenarioTests.XUnit" Version="1.0.1" />
<PackageVersion Include="xunit" Version="2.9.2" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.8.2" />
<PackageVersion Include="coverlet.collector" Version="6.0.2" />
</ItemGroup>
</Project>
4 changes: 4 additions & 0 deletions EntityFrameworkCore.Triggered.sln
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,17 @@ 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}"
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
Directory.Packages.props = Directory.Packages.props
LICENSE.md = LICENSE.md
README.md = README.md
EndProjectSection
Expand Down
6 changes: 0 additions & 6 deletions benchmarks/Directory.Build.props

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,85 +1,69 @@
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;

namespace EntityFrameworkCore.Triggered.Benchmarks
{
public class Student
{
public Guid Id { get; set; }

public string DisplayName { get; set; }
namespace EntityFrameworkCore.Triggered.Benchmarks;

public DateTimeOffset RegistrationDate { get; set; }
}
public class Student
{
public Guid Id { get; set; }

public class Course
{
public Guid Id { get; set; }
public string DisplayName { get; set; }

public string DisplayName { get; set; }
public DateTimeOffset RegistrationDate { get; set; }
}

public bool IsMandatory { get; set; }
public class Course
{
public Guid Id { get; set; }

}
public string DisplayName { get; set; }

public class StudentCourse
{
public Guid StudentId { get; set; }
public bool IsMandatory { get; set; }

public Guid CourseId { get; set; }
}

public Student Student { get; set; }
public class StudentCourse
{
public Guid StudentId { get; set; }

public Course Course { get; set; }
}
public Guid CourseId { get; set; }

public interface IApplicationContextContract : IDisposable
{
DatabaseFacade Database { get; }
public Student Student { get; set; }

int SaveChanges();
public Course Course { get; set; }
}

DbSet<Student> Students { get; set; }
public interface IApplicationContextContract : IDisposable
{
DatabaseFacade Database { get; }

DbSet<Course> Courses { get; set; }
int SaveChanges();

DbSet<StudentCourse> StudentCourses { get; set; }
}
DbSet<Student> Students { get; set; }

public class ApplicationContext : DbContext, IApplicationContextContract
{
public ApplicationContext(DbContextOptions<ApplicationContext> options) : base(options)
{
}
DbSet<Course> Courses { get; set; }

protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Entity<StudentCourse>().HasKey(x => new { x.StudentId, x.CourseId });
}
DbSet<StudentCourse> StudentCourses { get; set; }
}

public DbSet<Student> Students { get; set; }
public class ApplicationContext(DbContextOptions<ApplicationContext> options) : DbContext(options), IApplicationContextContract
{
protected override void OnModelCreating(ModelBuilder modelBuilder) => modelBuilder.Entity<StudentCourse>().HasKey(x => new { x.StudentId, x.CourseId });

public DbSet<Course> Courses { get; set; }
public DbSet<Student> Students { get; set; }

public DbSet<StudentCourse> StudentCourses { get; set; }
}
public DbSet<Course> Courses { get; set; }

public class TriggeredApplicationContext : DbContext, IApplicationContextContract
{
public TriggeredApplicationContext(DbContextOptions<TriggeredApplicationContext> options) : base(options)
{
}
public DbSet<StudentCourse> StudentCourses { get; set; }
}

protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Entity<StudentCourse>().HasKey(x => new { x.StudentId, x.CourseId });
}
public class TriggeredApplicationContext(DbContextOptions<TriggeredApplicationContext> options) : DbContext(options), IApplicationContextContract
{
protected override void OnModelCreating(ModelBuilder modelBuilder) => modelBuilder.Entity<StudentCourse>().HasKey(x => new { x.StudentId, x.CourseId });

public DbSet<Student> Students { get; set; }
public DbSet<Student> Students { get; set; }

public DbSet<Course> Courses { get; set; }
public DbSet<Course> Courses { get; set; }

public DbSet<StudentCourse> StudentCourses { get; set; }
}
public DbSet<StudentCourse> StudentCourses { get; set; }
}
Loading
Loading