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
10 changes: 5 additions & 5 deletions Dependencies.targets
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project>
<PropertyGroup Label="Common Versions">
<EFCoreVersion>[8.0.0,8.0.999]</EFCoreVersion>
<EFCoreVersion>[8.0.1,8.0.999]</EFCoreVersion>
</PropertyGroup>

<ItemGroup Label="Dependencies">
Expand All @@ -12,16 +12,16 @@
<PackageReference Update="SingleStoreConnector" Version="1.2.0" />

<PackageReference Update="NetTopologySuite" Version="2.5.0" />
<PackageReference Update="System.Text.Json" Version="8.0.0" />
<PackageReference Update="System.Text.Json" Version="8.0.1" />
<PackageReference Update="Newtonsoft.Json" Version="13.0.3" />

<PackageReference Update="Castle.Core" Version="5.1.1" />
<PackageReference Update="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="8.0.0" />
<PackageReference Update="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="8.0.0" />
<PackageReference Update="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="8.0.1" />
<PackageReference Update="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="8.0.1" />
<PackageReference Update="Microsoft.Bcl.AsyncInterfaces" Version="8.0.0" />
<PackageReference Update="Microsoft.Bcl.HashCode" Version="1.1.1" />
<PackageReference Update="Microsoft.Extensions.Caching.Memory" Version="8.0.0" />
<PackageReference Update="Microsoft.Extensions.Configuration.Binder" Version="8.0.0" />
<PackageReference Update="Microsoft.Extensions.Configuration.Binder" Version="8.0.1" />
<PackageReference Update="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="8.0.0" />
<PackageReference Update="Microsoft.Extensions.Configuration.FileExtensions" Version="8.0.0" />
<PackageReference Update="Microsoft.Extensions.Configuration.Json" Version="8.0.0" />
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

Milestone | Status | Release Date
----------|----------------------|-------------
8.0.1| released | February 2026
8.0.0| released | July 2025
7.0.1| released | March 2025
7.0.0| released | November 2024
Expand Down
4 changes: 2 additions & 2 deletions Version.props
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
- "rtm" - EF Core release independent, code quality production ready, major release
- "servicing" - EF Core release independent, code quality production ready, mainly bugfixes
-->
<VersionPrefix>8.0.0</VersionPrefix>
<PreReleaseVersionLabel>rtm</PreReleaseVersionLabel>
<VersionPrefix>8.0.1</VersionPrefix>
<PreReleaseVersionLabel>servicing</PreReleaseVersionLabel>

<!--
The following properties will automatically be set by CI builds when appropriate:
Expand Down
2 changes: 1 addition & 1 deletion dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"isRoot": true,
"tools": {
"dotnet-ef": {
"version": "8.0.0",
"version": "8.0.1",
"commands": [
"dotnet-ef"
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ public virtual SqlExpression Translate(SqlExpression instance, MethodInfo method
_sqlExpressionFactory.Constant(1))
},
method.ReturnType,
_typeMappingSource.FindMapping(method.ReturnType, storeType),
_typeMappingSource.FindMapping(method.ReturnType),
false);
}

Expand All @@ -138,7 +138,7 @@ public virtual SqlExpression Translate(SqlExpression instance, MethodInfo method
instance,
arguments[0],
method.ReturnType,
_typeMappingSource.FindMapping(method.ReturnType, storeType));
_typeMappingSource.FindMapping(method.ReturnType));
}

if (Equals(method, _isWithinDistance))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
using NetTopologySuite.Geometries;
using EntityFrameworkCore.SingleStore.Infrastructure.Internal;

// TODO: once we have geometry support in our adapter -- grab latest changes for this file
namespace EntityFrameworkCore.SingleStore.Storage.Internal
{
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Reflection;
using JetBrains.Annotations;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Design;
using Microsoft.EntityFrameworkCore.Infrastructure;
Expand All @@ -20,6 +20,11 @@ namespace EntityFrameworkCore.SingleStore.Design.Internal
{
public class SingleStoreAnnotationCodeGenerator : AnnotationCodeGenerator
{
private static readonly MethodInfo _modelUseIdentityColumnsMethodInfo
= typeof(SingleStoreModelBuilderExtensions).GetRequiredRuntimeMethod(
nameof(SingleStoreModelBuilderExtensions.AutoIncrementColumns),
typeof(ModelBuilder));

private static readonly MethodInfo _modelHasCharSetMethodInfo
= typeof(SingleStoreModelBuilderExtensions).GetRequiredRuntimeMethod(
nameof(SingleStoreModelBuilderExtensions.HasCharSet),
Expand All @@ -40,6 +45,12 @@ private static readonly MethodInfo _modelUseGuidCollationMethodInfo
typeof(ModelBuilder),
typeof(string));

private static readonly MethodInfo _modelHasAnnotationMethodInfo
= typeof(ModelBuilder).GetRequiredRuntimeMethod(
nameof(ModelBuilder.HasAnnotation),
typeof(string),
typeof(object));

private static readonly MethodInfo _entityTypeHasCharSetMethodInfo
= typeof(SingleStoreEntityTypeBuilderExtensions).GetRequiredRuntimeMethod(
nameof(SingleStoreEntityTypeBuilderExtensions.HasCharSet),
Expand All @@ -54,13 +65,24 @@ private static readonly MethodInfo _entityTypeUseCollationMethodInfo
typeof(string),
typeof(DelegationModes?));

private static readonly MethodInfo _propertyUseIdentityColumnMethodInfo
= typeof(SingleStorePropertyBuilderExtensions).GetRequiredRuntimeMethod(
nameof(SingleStorePropertyBuilderExtensions.UseSingleStoreIdentityColumn),
typeof(PropertyBuilder));

private static readonly MethodInfo _propertyUseComputedColumnMethodInfo
= typeof(SingleStorePropertyBuilderExtensions).GetRequiredRuntimeMethod(
nameof(SingleStorePropertyBuilderExtensions.UseSingleStoreComputedColumn),
typeof(PropertyBuilder));


private static readonly MethodInfo _propertyHasCharSetMethodInfo
= typeof(SingleStorePropertyBuilderExtensions).GetRequiredRuntimeMethod(
nameof(SingleStorePropertyBuilderExtensions.HasCharSet),
typeof(PropertyBuilder),
typeof(string));

public SingleStoreAnnotationCodeGenerator([NotNull] AnnotationCodeGeneratorDependencies dependencies)
public SingleStoreAnnotationCodeGenerator([JetBrains.Annotations.NotNull] AnnotationCodeGeneratorDependencies dependencies)
: base(dependencies)
{
}
Expand Down Expand Up @@ -95,7 +117,7 @@ protected override MethodCallCodeFragment GenerateFluentApi(IModel model, IAnnot
var delegationModes = model[SingleStoreAnnotationNames.CharSetDelegation] as DelegationModes?;
return new MethodCallCodeFragment(
_modelHasCharSetMethodInfo,
new[] {annotation.Value}
new[] { annotation.Value }
.AppendIfTrue(delegationModes.HasValue, delegationModes)
.ToArray());
}
Expand All @@ -116,7 +138,7 @@ protected override MethodCallCodeFragment GenerateFluentApi(IModel model, IAnnot
var delegationModes = model[SingleStoreAnnotationNames.CollationDelegation] as DelegationModes?;
return new MethodCallCodeFragment(
_modelUseCollationMethodInfo,
new[] {annotation.Value}
new[] { annotation.Value }
.AppendIfTrue(delegationModes.HasValue, delegationModes)
.ToArray());
}
Expand Down Expand Up @@ -147,7 +169,7 @@ protected override MethodCallCodeFragment GenerateFluentApi(IEntityType entityTy
var delegationModes = entityType[SingleStoreAnnotationNames.CharSetDelegation] as DelegationModes?;
return new MethodCallCodeFragment(
_entityTypeHasCharSetMethodInfo,
new[] {annotation.Value}
new[] { annotation.Value }
.AppendIfTrue(delegationModes.HasValue, delegationModes)
.ToArray());
}
Expand All @@ -166,7 +188,7 @@ protected override MethodCallCodeFragment GenerateFluentApi(IEntityType entityTy
var delegationModes = entityType[SingleStoreAnnotationNames.CollationDelegation] as DelegationModes?;
return new MethodCallCodeFragment(
_entityTypeUseCollationMethodInfo,
new[] {annotation.Value}
new[] { annotation.Value }
.AppendIfTrue(delegationModes.HasValue, delegationModes)
.ToArray());
}
Expand All @@ -193,7 +215,7 @@ protected override AttributeCodeFragment GenerateDataAnnotation(IEntityType enti
var delegationModes = entityType[SingleStoreAnnotationNames.CharSetDelegation] as DelegationModes?;
return new AttributeCodeFragment(
typeof(SingleStoreCharSetAttribute),
new[] {annotation.Value}
new[] { annotation.Value }
.AppendIfTrue(delegationModes.HasValue, delegationModes)
.ToArray());
}
Expand All @@ -212,7 +234,7 @@ protected override AttributeCodeFragment GenerateDataAnnotation(IEntityType enti
var delegationModes = entityType[SingleStoreAnnotationNames.CollationDelegation] as DelegationModes?;
return new AttributeCodeFragment(
typeof(SingleStoreCollationAttribute),
new[] {annotation.Value}
new[] { annotation.Value }
.AppendIfTrue(delegationModes.HasValue, delegationModes)
.ToArray());
}
Expand Down Expand Up @@ -241,7 +263,7 @@ protected override MethodCallCodeFragment GenerateFluentApi(IProperty property,

switch (annotation.Name)
{
case SingleStoreAnnotationNames.CharSet when annotation.Value is string {Length: > 0} charSet:
case SingleStoreAnnotationNames.CharSet when annotation.Value is string { Length: > 0 } charSet:
return new MethodCallCodeFragment(
_propertyHasCharSetMethodInfo,
charSet);
Expand All @@ -258,10 +280,75 @@ protected override AttributeCodeFragment GenerateDataAnnotation(IProperty proper

return annotation.Name switch
{
SingleStoreAnnotationNames.CharSet when annotation.Value is string {Length: > 0} charSet => new AttributeCodeFragment(typeof(SingleStoreCharSetAttribute), charSet),
RelationalAnnotationNames.Collation when annotation.Value is string {Length: > 0} collation => new AttributeCodeFragment(typeof(SingleStoreCollationAttribute), collation),
SingleStoreAnnotationNames.CharSet when annotation.Value is string { Length: > 0 } charSet => new AttributeCodeFragment(
typeof(SingleStoreCharSetAttribute), charSet),
RelationalAnnotationNames.Collation when annotation.Value is string { Length: > 0 } collation => new AttributeCodeFragment(
typeof(SingleStoreCollationAttribute), collation),
_ => base.GenerateDataAnnotation(property, annotation)
};
}


public override IReadOnlyList<MethodCallCodeFragment> GenerateFluentApiCalls(
IModel model,
IDictionary<string, IAnnotation> annotations)
{
var fragments = new List<MethodCallCodeFragment>(base.GenerateFluentApiCalls(model, annotations));

if (GenerateValueGenerationStrategy(annotations, onModel: true) is { } valueGenerationStrategy)
{
fragments.Add(valueGenerationStrategy);
}

return fragments;
}

public override IReadOnlyList<MethodCallCodeFragment> GenerateFluentApiCalls(
IProperty property,
IDictionary<string, IAnnotation> annotations)
{
var fragments = new List<MethodCallCodeFragment>(base.GenerateFluentApiCalls(property, annotations));

if (GenerateValueGenerationStrategy(annotations, onModel: false) is { } valueGenerationStrategy)
{
fragments.Add(valueGenerationStrategy);
}

return fragments;
}

private MethodCallCodeFragment GenerateValueGenerationStrategy(IDictionary<string, IAnnotation> annotations, bool onModel)
=> TryGetAndRemove(annotations, SingleStoreAnnotationNames.ValueGenerationStrategy, out SingleStoreValueGenerationStrategy strategy)
? strategy switch
{
SingleStoreValueGenerationStrategy.IdentityColumn => new MethodCallCodeFragment(
onModel
? _modelUseIdentityColumnsMethodInfo
: _propertyUseIdentityColumnMethodInfo),
SingleStoreValueGenerationStrategy.ComputedColumn => new MethodCallCodeFragment(_propertyUseComputedColumnMethodInfo),
SingleStoreValueGenerationStrategy.None => new MethodCallCodeFragment(
_modelHasAnnotationMethodInfo,
SingleStoreAnnotationNames.ValueGenerationStrategy,
SingleStoreValueGenerationStrategy.None),
_ => throw new ArgumentOutOfRangeException(strategy.ToString())
}
: null;

private static bool TryGetAndRemove<T>(
IDictionary<string, IAnnotation> annotations,
string annotationName,
[NotNullWhen(true)] out T annotationValue)
{
if (annotations.TryGetValue(annotationName, out var annotation)
&& annotation.Value is not null)
{
annotations.Remove(annotationName);
annotationValue = (T)annotation.Value;
return true;
}

annotationValue = default;
return false;
}
}
}
Loading