Skip to content

Commit

Permalink
Audit.NET / Audit.EntityFramework.Core: Upgrade to net7.0 as target, …
Browse files Browse the repository at this point in the history
…adding support for EF Core 7.0.0 (#544)
  • Loading branch information
thepirat000 committed Dec 3, 2022
1 parent 5d2e886 commit 754de28
Show file tree
Hide file tree
Showing 62 changed files with 564 additions and 424 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ All notable changes to Audit.NET and its extensions will be documented in this f

The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).

## [20.1.0] - 2022-12-01
- Audit.NET / Audit.EntityFramework.Core: Upgrade to net7.0 as target, adding support for EF Core 7.0.0 (#544)

## [20.0.4] - 2022-11-29
- Audit.EntityFramework / Audit.EntityFramework.Core: Adding SaveChangesGetAudit methods in the AuditDbContext to allow obtaining the EF audit event when saving changes (#546, #547)

Expand Down
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project>
<PropertyGroup>
<Version>20.0.4</Version>
<Version>20.1.0</Version>
<PackageReleaseNotes>
</PackageReleaseNotes>
</PropertyGroup>
Expand Down
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,7 @@ Field Name | Type | Description
**MachineName** | string | Executing machine name
**DomainName** | string | Current user domain
**CallingMethodName** | string | Calling method signature information
**StackTrace** | string | The full stack trace at the moment of the audit scope creation (NULL unless it's enabled by configuration)
**Exception** | string | Indicates if an Exception has been detected (NULL if no exception has been thrown)
**Culture** | string | Current culture identifier

Expand Down Expand Up @@ -685,6 +686,15 @@ The `ActionType` indicates when to perform the action. The allowed values are:
- `OnEventSaving`: When an Audit Scope's Event is about to be saved.
- `OnEventSaved`: After an Audit Scope's Event is saved.

### IncludeStackTrace

Include the stack trace in the event. Default is `false`.

```c#
Audit.Core.Configuration.IncludeStackTrace = true;
```


### Global switch off

You can disable audit logging by setting the static property `Configuration.AuditDisabled` to `true`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<AssemblyTitle>Audit.EntityFramework.Core.v3</AssemblyTitle>
<Authors>Federico Colombo</Authors>
<TargetFrameworks>netstandard2.0;net5.0</TargetFrameworks>
<DefineConstants>$(DefineConstants);STRONG_NAME;EF_CORE;EF_CORE_3</DefineConstants>
<DefineConstants>$(DefineConstants);STRONG_NAME;EF_CORE;EF_CORE_3;EF_CORE_2_OR_GREATER;EF_CORE_3_OR_GREATER</DefineConstants>
<NoWarn>$(NoWarn);1591</NoWarn>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<AssemblyName>Audit.EntityFramework.Core.v3</AssemblyName>
Expand Down
219 changes: 112 additions & 107 deletions src/Audit.EntityFramework.Core/Audit.EntityFramework.Core.csproj
Original file line number Diff line number Diff line change
@@ -1,124 +1,129 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<Description>Generate Audit Logs from EntityFramework context changes</Description>
<Copyright>Copyright 2016</Copyright>
<AssemblyTitle>Audit.EntityFramework.Core</AssemblyTitle>
<Authors>Federico Colombo</Authors>
<TargetFrameworks>netstandard1.5;netstandard2.0;net461;netstandard2.1;net472;net5.0;net6.0</TargetFrameworks>
<DefineConstants>$(DefineConstants);STRONG_NAME;EF_CORE</DefineConstants>
<NoWarn>$(NoWarn);1591</NoWarn>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<AssemblyName>Audit.EntityFramework.Core</AssemblyName>
<AssemblyOriginatorKeyFile>../StrongName/Audit.NET.snk</AssemblyOriginatorKeyFile>
<SignAssembly>true</SignAssembly>
<PublicSign Condition=" '$(OS)' != 'Windows_NT' ">true</PublicSign>
<PackageId>Audit.EntityFramework.Core</PackageId>
<PackageTags>Audit;Trail;Log;EntityFramework;Core</PackageTags>
<PackageIcon>icon.png</PackageIcon>
<PackageProjectUrl>https://github.com/thepirat000/Audit.NET</PackageProjectUrl>
<NetStandardImplicitPackageVersion Condition=" '$(TargetFramework)' == 'netstandard2.0' ">2.0.3</NetStandardImplicitPackageVersion>
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<RepositoryUrl>https://github.com/thepirat000/Audit.NET</RepositoryUrl>
</PropertyGroup>
<PropertyGroup>
<Description>Generate Audit Logs from EntityFramework context changes</Description>
<Copyright>Copyright 2016</Copyright>
<AssemblyTitle>Audit.EntityFramework.Core</AssemblyTitle>
<Authors>Federico Colombo</Authors>
<TargetFrameworks>netstandard1.5;netstandard2.0;net461;netstandard2.1;net472;net5.0;net6.0;net7.0</TargetFrameworks>
<DefineConstants>$(DefineConstants);STRONG_NAME;EF_CORE</DefineConstants>
<NoWarn>$(NoWarn);1591</NoWarn>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<AssemblyName>Audit.EntityFramework.Core</AssemblyName>
<AssemblyOriginatorKeyFile>../StrongName/Audit.NET.snk</AssemblyOriginatorKeyFile>
<SignAssembly>true</SignAssembly>
<PublicSign Condition=" '$(OS)' != 'Windows_NT' ">true</PublicSign>
<PackageId>Audit.EntityFramework.Core</PackageId>
<PackageTags>Audit;Trail;Log;EntityFramework;Core</PackageTags>
<PackageIcon>icon.png</PackageIcon>
<PackageProjectUrl>https://github.com/thepirat000/Audit.NET</PackageProjectUrl>
<NetStandardImplicitPackageVersion Condition=" '$(TargetFramework)' == 'netstandard2.0' ">2.0.3</NetStandardImplicitPackageVersion>
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<RepositoryUrl>https://github.com/thepirat000/Audit.NET</RepositoryUrl>
</PropertyGroup>

<PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard1.5' ">
<DefineConstants>$(DefineConstants);EF_CORE_1</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(TargetFramework)' == 'net461' ">
<DefineConstants>$(DefineConstants);EF_CORE_2</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' or '$(TargetFramework)' == 'net472' ">
<DefineConstants>$(DefineConstants);EF_CORE_3</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard2.1' or '$(TargetFramework)' == 'net5.0' ">
<DefineConstants>$(DefineConstants);EF_CORE_5</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(TargetFramework)' == 'net6.0' ">
<DefineConstants>$(DefineConstants);EF_CORE_6</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard1.5' ">
<DefineConstants>$(DefineConstants);EF_CORE_1</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(TargetFramework)' == 'net461' ">
<DefineConstants>$(DefineConstants);EF_CORE_2;EF_CORE_2_OR_GREATER</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' or '$(TargetFramework)' == 'net472' ">
<DefineConstants>$(DefineConstants);EF_CORE_3;EF_CORE_2_OR_GREATER;EF_CORE_3_OR_GREATER</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard2.1' or '$(TargetFramework)' == 'net5.0' ">
<DefineConstants>$(DefineConstants);EF_CORE_5;EF_CORE_2_OR_GREATER;EF_CORE_3_OR_GREATER;EF_CORE_5_OR_GREATER</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(TargetFramework)' == 'net6.0' ">
<DefineConstants>$(DefineConstants);EF_CORE_6;EF_CORE_2_OR_GREATER;EF_CORE_3_OR_GREATER;EF_CORE_5_OR_GREATER;EF_CORE_6_OR_GREATER</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(TargetFramework)' == 'net7.0' ">
<DefineConstants>$(DefineConstants);EF_CORE_7;EF_CORE_2_OR_GREATER;EF_CORE_3_OR_GREATER;EF_CORE_5_OR_GREATER;EF_CORE_6_OR_GREATER</DefineConstants>
</PropertyGroup>

<ItemGroup>
<None Include="..\..\LICENSE" Pack="true" PackagePath="LICENSE" />
</ItemGroup>

<ItemGroup>
<Compile Include="..\Audit.EntityFramework\**\*.cs" Exclude="..\Audit.EntityFramework\obj\**\*.*;..\**\AssemblyInfo.cs" />
</ItemGroup>
<None Include="..\..\LICENSE" Pack="true" PackagePath="LICENSE" />
</ItemGroup>

<ItemGroup>
<Compile Remove="ConfigurationApi\**" />
<EmbeddedResource Remove="ConfigurationApi\**" />
<None Remove="ConfigurationApi\**" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\Audit.EntityFramework\**\*.cs" Exclude="..\Audit.EntityFramework\obj\**\*.*;..\**\AssemblyInfo.cs" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Audit.NET\Audit.NET.csproj" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.1' ">
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="5.0.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="5.0.1" />
<PackageReference Include="Microsoft.CSharp" Version="4.5.0" />
</ItemGroup>
<ItemGroup>
<Compile Remove="ConfigurationApi\**" />
<EmbeddedResource Remove="ConfigurationApi\**" />
<None Remove="ConfigurationApi\**" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' ">
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="3.1.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="3.1.0" />
<PackageReference Include="Microsoft.CSharp" Version="4.5.0" />
<PackageReference Include="System.Data.DataSetExtensions" Version="4.5.0" />
<ItemGroup>
<ProjectReference Include="..\Audit.NET\Audit.NET.csproj" />
</ItemGroup>

</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.1' ">
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="5.0.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="5.0.1" />
<PackageReference Include="Microsoft.CSharp" Version="4.5.0" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard1.5' ">
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="1.1.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="1.1.2" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' ">
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="3.1.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="3.1.0" />
<PackageReference Include="Microsoft.CSharp" Version="4.5.0" />
<PackageReference Include="System.Data.DataSetExtensions" Version="4.5.0" />

<ItemGroup Condition=" '$(TargetFramework)' == 'net461' ">
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="2.2.4" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="2.2.4" />
<Reference Include="System" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Transactions" />
</ItemGroup>
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net472' ">
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="3.1.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="3.1.0" />
<Reference Include="System" />
<PackageReference Include="System.Data.DataSetExtensions" Version="4.5.0" />
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard1.5' ">
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="1.1.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="1.1.2" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net461' ">
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="2.2.4" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="2.2.4" />
<Reference Include="System" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Transactions" />
</ItemGroup>

<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Transactions" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'net472' ">
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="3.1.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="3.1.0" />
<Reference Include="System" />
<PackageReference Include="System.Data.DataSetExtensions" Version="4.5.0" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Transactions" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' != 'net5.0' AND '$(TargetFramework)' != 'net6.0' ">
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'net5.0' ">
<PackageReference Include="System.Text.Json" Version="5.0.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="5.0.8" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="5.0.8" />
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'net6.0' ">
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="6.0.0" />
</ItemGroup>
<PropertyGroup Condition=" '$(TargetFramework)' != 'net5.0' AND '$(TargetFramework)' != 'net6.0' ">
<DefineConstants>$(DefineConstants);IS_NK_JSON</DefineConstants>
</PropertyGroup>
<ItemGroup Condition=" '$(TargetFramework)' != 'net5.0' AND '$(TargetFramework)' != 'net6.0' AND '$(TargetFramework)' != 'net7.0' ">
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'net5.0' ">
<PackageReference Include="System.Text.Json" Version="5.0.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="5.0.8" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="5.0.8" />
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'net6.0' ">
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="6.0.0" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'net7.0' ">
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="7.0.0" />
</ItemGroup>
<PropertyGroup Condition=" '$(TargetFramework)' != 'net5.0' AND '$(TargetFramework)' != 'net6.0' AND '$(TargetFramework)' != 'net7.0' ">
<DefineConstants>$(DefineConstants);IS_NK_JSON</DefineConstants>
</PropertyGroup>

<PropertyGroup Condition=" '$(TargetFramework)' == 'net5.0' OR '$(TargetFramework)' == 'net6.0' ">
<DefineConstants>$(DefineConstants);IS_TEXT_JSON</DefineConstants>
</PropertyGroup>
<ItemGroup>
<None Include="images\icon.png" Pack="true" PackagePath="\"/>
</ItemGroup>
<PropertyGroup Condition=" '$(TargetFramework)' == 'net5.0' OR '$(TargetFramework)' == 'net6.0' OR '$(TargetFramework)' == 'net7.0' ">
<DefineConstants>$(DefineConstants);IS_TEXT_JSON</DefineConstants>
</PropertyGroup>

<ItemGroup>
<None Include="images\icon.png" Pack="true" PackagePath="\" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion src/Audit.EntityFramework.Core/TransactionEvent.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if EF_CORE_3 || EF_CORE_5 || EF_CORE_6
#if EF_CORE_3_OR_GREATER
using System.Data;

namespace Audit.EntityFramework
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
</ItemGroup>

<PropertyGroup>
<DefineConstants>$(DefineConstants);EF_CORE;EF_CORE_3</DefineConstants>
<DefineConstants>$(DefineConstants);EF_CORE;EF_CORE_3;EF_CORE_2_OR_GREATER;EF_CORE_3_OR_GREATER</DefineConstants>
</PropertyGroup>

<ItemGroup>
Expand Down
Loading

0 comments on commit 754de28

Please sign in to comment.