Skip to content

Commit

Permalink
Added .NET 8 (#181)
Browse files Browse the repository at this point in the history
* Alignment to latest package version

* Added specific classes of EF Core 8

* Update compilation between multiple versions

* Update protobuf dependencies

* Update test to accept EF Core 8

* Bump KNet to version 2.3.0
  • Loading branch information
masesdevelopers authored Nov 25, 2023
1 parent 51a068e commit 3386efb
Show file tree
Hide file tree
Showing 88 changed files with 11,086 additions and 57 deletions.
2 changes: 1 addition & 1 deletion src/documentation/articles/intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,4 @@ Do you want to help us?
- open [issues](https://github.com/masesgroup/KEFCore/issues) to request features or report bugs :bug:
- improves the project with Pull Requests

This project adheres to the Contributor [Covenant code of conduct](CODE_OF_CONDUCT.md). By participating, you are expected to uphold this code. Please report unacceptable behavior to coc_reporting@masesgroup.com.
This project adheres to the Contributor [Covenant code of conduct](https://github.com/masesgroup/KEFCore/blob/master/CODE_OF_CONDUCT.md). By participating, you are expected to uphold this code. Please report unacceptable behavior to coc_reporting@masesgroup.com.
2 changes: 1 addition & 1 deletion src/documentation/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Do you want to help us?
- open [issues](https://github.com/masesgroup/KEFCore/issues) to request features or report bugs :bug:
- improves the project with Pull Requests

This project adheres to the Contributor [Covenant code of conduct](CODE_OF_CONDUCT.md). By participating, you are expected to uphold this code. Please report unacceptable behavior to coc_reporting@masesgroup.com.
This project adheres to the Contributor [Covenant code of conduct](https://github.com/masesgroup/KEFCore/blob/master/CODE_OF_CONDUCT.md). By participating, you are expected to uphold this code. Please report unacceptable behavior to coc_reporting@masesgroup.com.

---
## Summary
Expand Down
4 changes: 2 additions & 2 deletions src/net/Common/Common.props
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
<Owners>MASES s.r.l.</Owners>
<Authors>MASES s.r.l.</Authors>
<Company>MASES s.r.l.</Company>
<Version>1.0.0.0</Version>
<TargetFrameworks>net6.0;net7.0</TargetFrameworks>
<Version>1.1.0.0</Version>
<TargetFrameworks>net6.0;net7.0;net8.0</TargetFrameworks>
<LangVersion>latest</LangVersion>
<GenerateAssemblyInfo>true</GenerateAssemblyInfo>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="MASES.KNet.Serialization.Avro" Version="2.2.0" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1">
<PackageReference Include="MASES.KNet.Serialization.Avro" Version="2.3.0" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
2 changes: 1 addition & 1 deletion src/net/KEFCore.SerDes.Avro/KEFCore.SerDes.Avro.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
<ItemGroup>
<ProjectReference Include="..\KEFCore.SerDes\KEFCore.SerDes.csproj" />
<PackageReference Include="Apache.Avro" Version="1.11.3" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1">
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
1 change: 1 addition & 0 deletions src/net/KEFCore.SerDes.Protobuf/Generated/GenericValue.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ static GenericValueReflection() {
/// [START messages]
/// Our address book file is just one of these.
/// </summary>
[global::System.Diagnostics.DebuggerDisplayAttribute("{ToString(),nq}")]
public sealed partial class GenericValue : pb::IMessage<GenericValue>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
Expand Down
2 changes: 2 additions & 0 deletions src/net/KEFCore.SerDes.Protobuf/Generated/KeyContainer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ static KeyContainerReflection() {
/// <summary>
/// [START messages]
/// </summary>
[global::System.Diagnostics.DebuggerDisplayAttribute("{ToString(),nq}")]
public sealed partial class PrimaryKeyType : pb::IMessage<PrimaryKeyType>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
Expand Down Expand Up @@ -226,6 +227,7 @@ public void MergeFrom(pb::CodedInputStream input) {
/// <summary>
/// Our address book file is just one of these.
/// </summary>
[global::System.Diagnostics.DebuggerDisplayAttribute("{ToString(),nq}")]
public sealed partial class KeyContainer : pb::IMessage<KeyContainer>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
Expand Down
2 changes: 2 additions & 0 deletions src/net/KEFCore.SerDes.Protobuf/Generated/ValueContainer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ static ValueContainerReflection() {
/// <summary>
/// [START messages]
/// </summary>
[global::System.Diagnostics.DebuggerDisplayAttribute("{ToString(),nq}")]
public sealed partial class PropertyDataRecord : pb::IMessage<PropertyDataRecord>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
Expand Down Expand Up @@ -360,6 +361,7 @@ public void MergeFrom(pb::CodedInputStream input) {
/// <summary>
/// Our address book file is just one of these.
/// </summary>
[global::System.Diagnostics.DebuggerDisplayAttribute("{ToString(),nq}")]
public sealed partial class ValueContainer : pb::IMessage<ValueContainer>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
Expand Down
14 changes: 7 additions & 7 deletions src/net/KEFCore.SerDes.Protobuf/KEFCore.SerDes.Protobuf.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -42,21 +42,21 @@

<ItemGroup>
<ProjectReference Include="..\KEFCore.SerDes\KEFCore.SerDes.csproj" />
<PackageReference Include="Google.Protobuf" Version="3.25.0" />
<PackageReference Include="Google.Protobuf.Tools" Version="3.25.0">
<PackageReference Include="Google.Protobuf" Version="3.25.1" />
<PackageReference Include="Google.Protobuf.Tools" Version="3.25.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1">
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>

<Target Name="PreBuild" BeforeTargets="PreBuildEvent">
<Exec Command="$(protoc_windows32) -I=$(protoc_tools) --proto_path=$(ProjectDir) --csharp_out=$(ProjectDir)Generated *.proto" Condition="'$(OS)' == 'Windows_NT' And '$([System.Environment]::Is64BitOperatingSystem)' == 'False'"/>
<Exec Command="$(protoc_windows64) -I=$(protoc_tools) --proto_path=$(ProjectDir) --csharp_out=$(ProjectDir)Generated *.proto" Condition="'$(OS)' == 'Windows_NT' And '$([System.Environment]::Is64BitOperatingSystem)' == 'True'"/>
<Exec Command="$(protoc_linux32) -I=$(protoc_tools) --proto_path=$(ProjectDir) --csharp_out=$(ProjectDir)Generated *.proto" Condition="'$(OS)' != 'Windows_NT' And '$([System.Environment]::Is64BitOperatingSystem)' == 'False'"/>
<Exec Command="$(protoc_linux64) -I=$(protoc_tools) --proto_path=$(ProjectDir) --csharp_out=$(ProjectDir)Generated *.proto" Condition="'$(OS)' != 'Windows_NT' And '$([System.Environment]::Is64BitOperatingSystem)' == 'True'"/>
<Exec Command="$(protoc_windows32) -I=$(protoc_tools) --proto_path=$(ProjectDir) --csharp_out=$(ProjectDir)Generated *.proto" Condition="'$(OS)' == 'Windows_NT' And '$([System.Environment]::Is64BitOperatingSystem)' == 'False'" />
<Exec Command="$(protoc_windows64) -I=$(protoc_tools) --proto_path=$(ProjectDir) --csharp_out=$(ProjectDir)Generated *.proto" Condition="'$(OS)' == 'Windows_NT' And '$([System.Environment]::Is64BitOperatingSystem)' == 'True'" />
<Exec Command="$(protoc_linux32) -I=$(protoc_tools) --proto_path=$(ProjectDir) --csharp_out=$(ProjectDir)Generated *.proto" Condition="'$(OS)' != 'Windows_NT' And '$([System.Environment]::Is64BitOperatingSystem)' == 'False'" />
<Exec Command="$(protoc_linux64) -I=$(protoc_tools) --proto_path=$(ProjectDir) --csharp_out=$(ProjectDir)Generated *.proto" Condition="'$(OS)' != 'Windows_NT' And '$([System.Environment]::Is64BitOperatingSystem)' == 'True'" />
</Target>
</Project>
9 changes: 5 additions & 4 deletions src/net/KEFCore.SerDes/KEFCore.SerDes.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,14 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.24" PrivateAssets="none" Condition="'$(TargetFramework)' == 'net6.0'" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.13" PrivateAssets="none" Condition="'$(TargetFramework)' == 'net7.0'" />
<PackageReference Include="MASES.KNet" Version="2.2.0">
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.25" PrivateAssets="none" Condition="'$(TargetFramework)' == 'net6.0'" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.14" PrivateAssets="none" Condition="'$(TargetFramework)' == 'net7.0'" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.0" PrivateAssets="none" Condition="'$(TargetFramework)' == 'net8.0'" />
<PackageReference Include="MASES.KNet" Version="2.3.0">
<IncludeAssets>All</IncludeAssets>
<PrivateAssets>None</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1">
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ public static IServiceCollection AddEntityFrameworkKafkaDatabase(this IServiceCo
.TryAdd<ITypeMappingSource, KafkaTypeMappingSource>()
.TryAdd<IShapedQueryCompilingExpressionVisitorFactory, KafkaShapedQueryCompilingExpressionVisitorFactory>()
.TryAdd<IQueryableMethodTranslatingExpressionVisitorFactory, KafkaQueryableMethodTranslatingExpressionVisitorFactory>()
#if NET8_0
.TryAdd<IQueryTranslationPreprocessorFactory, KafkaQueryTranslationPreprocessorFactory>()
#endif
.TryAdd<ISingletonOptions, IKafkaSingletonOptions>(p => p.GetRequiredService<IKafkaSingletonOptions>())
.TryAddProviderSpecificServices(
b => b
Expand Down
18 changes: 17 additions & 1 deletion src/net/KEFCore/KEFCore.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,22 @@
<RunAnalyzersDuringLiveAnalysis>True</RunAnalyzersDuringLiveAnalysis>
<RunAnalyzersDuringBuild>False</RunAnalyzersDuringBuild>
</PropertyGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net8.0'">
<Compile Remove="Query\Internal\**" />
<EmbeddedResource Remove="Query\Internal\**" />
<None Remove="Query\Internal\**" />
<Compile Remove="Shared\**" />
<EmbeddedResource Remove="Shared\**" />
<None Remove="Shared\**" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' != 'net8.0'">
<Compile Remove="Query\Internal8\**" />
<EmbeddedResource Remove="Query\Internal8\**" />
<None Remove="Query\Internal8\**" />
<Compile Remove="Shared8\**" />
<EmbeddedResource Remove="Shared8\**" />
<None Remove="Shared8\**" />
</ItemGroup>

<ItemGroup>
<Using Include="System.Diagnostics" />
Expand Down Expand Up @@ -66,7 +82,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="All" />
<ProjectReference Include="..\KEFCore.SerDes\KEFCore.SerDes.csproj" />
</ItemGroup>
</Project>
6 changes: 6 additions & 0 deletions src/net/KEFCore/Properties/KafkaStrings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions src/net/KEFCore/Properties/KafkaStrings.resx
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,9 @@
<value>Transactions are not supported by the Kafka store. See http://go.microsoft.com/fwlink/?LinkId=800142</value>
<comment>Warning KafkaEventId.TransactionIgnoredWarning</comment>
</data>
<data name="NonComposedGroupByNotSupported" xml:space="preserve">
<value>A 'GroupBy' operation which is not composed into aggregate or projection of elements is not supported.</value>
</data>
<data name="NoQueryStrings" xml:space="preserve">
<value>There is no query string because the Kafka provider does not use a string-based query language.</value>
</data>
Expand Down
1 change: 0 additions & 1 deletion src/net/KEFCore/Query/Internal/KafkaQueryContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
*/

using MASES.EntityFrameworkCore.KNet.Storage.Internal;
using System.Collections.Concurrent;

namespace MASES.EntityFrameworkCore.KNet.Query.Internal;
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ protected override Expression VisitMethodCall(MethodCallExpression methodCallExp
}
#if NET6_0
/// <inheritdoc/>
[Obsolete]
protected override ShapedQueryExpression CreateShapedQueryExpression(Type elementType)
{
throw new NotImplementedException();
Expand Down
86 changes: 86 additions & 0 deletions src/net/KEFCore/Query/Internal8/AnonymousObject.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using JetBrains.Annotations;

namespace MASES.EntityFrameworkCore.KNet.Query.Internal;

/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public readonly struct AnonymousObject
{
private readonly object[] _values;

/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public static readonly ConstructorInfo AnonymousObjectCtor
= typeof(AnonymousObject).GetTypeInfo()
.DeclaredConstructors
.Single(c => c.GetParameters().Length == 1);

/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
[UsedImplicitly]
public AnonymousObject(object[] values)
{
_values = values;
}

/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public static bool operator ==(AnonymousObject x, AnonymousObject y)
=> x.Equals(y);

/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public static bool operator !=(AnonymousObject x, AnonymousObject y)
=> !x.Equals(y);

/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public override bool Equals(object? obj)
=> obj is not null
&& (obj is AnonymousObject anonymousObject
&& _values.SequenceEqual(anonymousObject._values));

/// <summary>
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to
/// the same compatibility standards as public APIs. It may be changed or removed without notice in
/// any release. You should only use it directly in your code with extreme caution and knowing that
/// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary>
public override int GetHashCode()
{
var hash = new HashCode();
foreach (var value in _values)
{
hash.Add(value);
}

return hash.ToHashCode();
}
}
Loading

0 comments on commit 3386efb

Please sign in to comment.