net 6 update

pull/131/head
Christopher Jolly 4 years ago
parent b1fa143d4d
commit 426240084d

@ -1,34 +1,34 @@
<Project> <Project>
<PropertyGroup> <PropertyGroup>
<DotnetRuntimeVersion>5.0.6</DotnetRuntimeVersion> <DotnetRuntimeVersion>6.0.0</DotnetRuntimeVersion>
<EFCoreVersion>[$(DotnetRuntimeVersion), 6.0.0)</EFCoreVersion> <EFCoreVersion>[$(DotnetRuntimeVersion), 7.0.0)</EFCoreVersion>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<!-- Common --> <!-- Common -->
<PackageReference Update="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="5.0.0" /> <PackageReference Update="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="6.0.0" />
<PackageReference Update="Microsoft.Extensions.Configuration.Json" Version="5.0.0" /> <PackageReference Update="Microsoft.Extensions.Configuration.Json" Version="6.0.0" />
<PackageReference Update="Microsoft.Extensions.Caching.Memory" Version="5.0.0" /> <PackageReference Update="Microsoft.Extensions.Caching.Memory" Version="6.0.0" />
<PackageReference Update="Microsoft.EntityFrameworkCore" Version="$(EFCoreVersion)" /> <PackageReference Update="Microsoft.EntityFrameworkCore" Version="$(EFCoreVersion)" />
<PackageReference Update="Microsoft.EntityFrameworkCore.Relational" Version="$(EFCoreVersion)" /> <PackageReference Update="Microsoft.EntityFrameworkCore.Relational" Version="$(EFCoreVersion)" />
<PackageReference Update="System.Diagnostics.DiagnosticSource" Version="5.0.1" /> <PackageReference Update="System.Diagnostics.DiagnosticSource" Version="5.0.1" />
<PackageReference Update="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="3.0.0" /> <PackageReference Update="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="3.0.0" />
<PackageReference Update="DotNetAnalyzers.DocumentationAnalyzers" Version="1.0.0-beta.59" /> <PackageReference Update="DotNetAnalyzers.DocumentationAnalyzers" Version="1.0.0-beta.59" />
<PackageReference Update="Microsoft.SourceLink.GitHub" Version="1.0.0" /> <PackageReference Update="Microsoft.SourceLink.GitHub" Version="1.1.1" />
<!-- EntityFrameworkCore.Jet.Data --> <!-- EntityFrameworkCore.Jet.Data -->
<PackageReference Update="System.ValueTuple" Version="4.5.0" /> <PackageReference Update="System.ValueTuple" Version="4.5.0" />
<PackageReference Update="Microsoft.CSharp" Version="4.7.0" /> <PackageReference Update="Microsoft.CSharp" Version="4.7.0" />
<PackageReference Update="Microsoft.Win32.Registry" Version="5.0.0" /> <PackageReference Update="Microsoft.Win32.Registry" Version="6.0.0-preview.5.21301.5" />
<!-- EFCore.Jet --> <!-- EFCore.Jet -->
<PackageReference Update="Microsoft.Extensions.DependencyInjection" Version="5.0.1" /> <PackageReference Update="Microsoft.Extensions.DependencyInjection" Version="5.0.1" />
<PackageReference Update="Microsoft.Extensions.Configuration" Version="5.0.0" /> <PackageReference Update="Microsoft.Extensions.Configuration" Version="6.0.0" />
<PackageReference Update="Microsoft.Extensions.Logging" Version="5.0.0" /> <PackageReference Update="Microsoft.Extensions.Logging" Version="6.0.0" />
<PackageReference Update="Microsoft.Bcl.AsyncInterfaces" Version="5.0.0" /> <PackageReference Update="Microsoft.Bcl.AsyncInterfaces" Version="6.0.0" />
<PackageReference Update="Microsoft.Bcl.HashCode" Version="1.1.1" /> <PackageReference Update="Microsoft.Bcl.HashCode" Version="1.1.1" />
<PackageReference Update="System.Collections.Immutable" Version="5.0.0" /> <PackageReference Update="System.Collections.Immutable" Version="6.0.0" />
<PackageReference Update="System.ComponentModel.Annotations" Version="5.0.0" /> <PackageReference Update="System.ComponentModel.Annotations" Version="6.0.0" />
<!--<PackageReference Update="Microsoft.EntityFrameworkCore" Version="$(MicrosoftEntityFrameworkCoreVersion)" />--> <!--<PackageReference Update="Microsoft.EntityFrameworkCore" Version="$(MicrosoftEntityFrameworkCoreVersion)" />-->
<!--<PackageReference Update="Microsoft.EntityFrameworkCore.Relational" Version="$(MicrosoftEntityFrameworkCoreRelationalVersion)" />--> <!--<PackageReference Update="Microsoft.EntityFrameworkCore.Relational" Version="$(MicrosoftEntityFrameworkCoreRelationalVersion)" />-->
<!--<PackageReference Update="Microsoft.Extensions.Configuration.Json" Version="$(MicrosoftExtensionsConfigurationJsonVersion)" />--> <!--<PackageReference Update="Microsoft.Extensions.Configuration.Json" Version="$(MicrosoftExtensionsConfigurationJsonVersion)" />-->
@ -37,8 +37,8 @@
<!--<PackageReference Update="System.Diagnostics.DiagnosticSource" Version="$(SystemDiagnosticsDiagnosticSourceVersion)" />--> <!--<PackageReference Update="System.Diagnostics.DiagnosticSource" Version="$(SystemDiagnosticsDiagnosticSourceVersion)" />-->
<!-- Tests --> <!-- Tests -->
<PackageReference Update="System.Data.Odbc" Version="5.0.0" /> <PackageReference Update="System.Data.Odbc" Version="6.0.0" />
<PackageReference Update="System.Data.OleDb" Version="5.0.0" /> <PackageReference Update="System.Data.OleDb" Version="6.0.0" />
<PackageReference Update="Microsoft.EntityFrameworkCore.Design" Version="$(EFCoreVersion)" /> <PackageReference Update="Microsoft.EntityFrameworkCore.Design" Version="$(EFCoreVersion)" />
<PackageReference Update="Microsoft.EntityFrameworkCore.Relational.Specification.Tests" Version="$(EFCoreVersion)" /> <PackageReference Update="Microsoft.EntityFrameworkCore.Relational.Specification.Tests" Version="$(EFCoreVersion)" />
<PackageReference Update="Microsoft.NET.Test.Sdk" Version="16.9.4" /> <PackageReference Update="Microsoft.NET.Test.Sdk" Version="16.9.4" />
@ -60,7 +60,7 @@
<PackageReference Update="xunit.assert" Version="2.4.1" /> <PackageReference Update="xunit.assert" Version="2.4.1" />
<PackageReference Update="xunit.runner.visualstudio" Version="2.4.3" /> <PackageReference Update="xunit.runner.visualstudio" Version="2.4.3" />
<PackageReference Update="xunit.runner.console" Version="2.4.1" /> <PackageReference Update="xunit.runner.console" Version="2.4.1" />
<PackageReference Update="Microsoft.Extensions.Configuration.FileExtensions" Version="5.0.0" /> <PackageReference Update="Microsoft.Extensions.Configuration.FileExtensions" Version="6.0.0" />
<!--<PackageReference Update="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="$(MicrosoftExtensionsConfigurationEnvironmentVariablesVersion)" />--> <!--<PackageReference Update="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="$(MicrosoftExtensionsConfigurationEnvironmentVariablesVersion)" />-->
<!--<PackageReference Update="Microsoft.Extensions.Configuration.Json" Version="$(MicrosoftExtensionsConfigurationJsonVersion)" />--> <!--<PackageReference Update="Microsoft.Extensions.Configuration.Json" Version="$(MicrosoftExtensionsConfigurationJsonVersion)" />-->
<!--<PackageReference Update="System.Data.Odbc" Version="$(SystemDataOdbcVersion)" />--> <!--<PackageReference Update="System.Data.Odbc" Version="$(SystemDataOdbcVersion)" />-->
@ -82,7 +82,7 @@
<!-- EFCore.Jet.Tests --> <!-- EFCore.Jet.Tests -->
<PackageReference Update="Microsoft.CodeAnalysis.CSharp" Version="3.9.0" /> <PackageReference Update="Microsoft.CodeAnalysis.CSharp" Version="3.9.0" />
<PackageReference Update="Microsoft.Extensions.DependencyModel" Version="5.0.0" /> <PackageReference Update="Microsoft.Extensions.DependencyModel" Version="6.0.0" />
<PackageReference Update="Moq" Version="4.16.1" /> <PackageReference Update="Moq" Version="4.16.1" />
<!--<PackageReference Update="Microsoft.EntityFrameworkCore.Design" Version="$(MicrosoftEntityFrameworkCoreDesignVersion)" />--> <!--<PackageReference Update="Microsoft.EntityFrameworkCore.Design" Version="$(MicrosoftEntityFrameworkCoreDesignVersion)" />-->
<!--<PackageReference Update="Microsoft.EntityFrameworkCore.Relational" Version="$(MicrosoftEntityFrameworkCoreRelationalVersion)" />--> <!--<PackageReference Update="Microsoft.EntityFrameworkCore.Relational" Version="$(MicrosoftEntityFrameworkCoreRelationalVersion)" />-->

@ -23,9 +23,9 @@
</PropertyGroup> </PropertyGroup>
<PropertyGroup> <PropertyGroup>
<DefaultNetCoreTargetFramework>net5.0</DefaultNetCoreTargetFramework> <DefaultNetCoreTargetFramework>net6.0</DefaultNetCoreTargetFramework>
<WindowsOnlyNetCoreTargetFramework>net5.0-windows</WindowsOnlyNetCoreTargetFramework> <WindowsOnlyNetCoreTargetFramework>net6.0-windows</WindowsOnlyNetCoreTargetFramework>
<DefaultNetCoreLegacyTargetFramework>netcoreapp5.0</DefaultNetCoreLegacyTargetFramework> <DefaultNetCoreLegacyTargetFramework>netcoreapp6.0</DefaultNetCoreLegacyTargetFramework>
<DefaultNetStandardTargetFramework>netstandard2.1</DefaultNetStandardTargetFramework> <DefaultNetStandardTargetFramework>netstandard2.1</DefaultNetStandardTargetFramework>
</PropertyGroup> </PropertyGroup>

@ -8,7 +8,7 @@
- "rtm" - "rtm"
- "servicing" - "servicing"
--> -->
<VersionPrefix>5.0.0</VersionPrefix> <VersionPrefix>6.0.0</VersionPrefix>
<PreReleaseVersionLabel>alpha</PreReleaseVersionLabel> <PreReleaseVersionLabel>alpha</PreReleaseVersionLabel>
<PreReleaseVersionIteration>1</PreReleaseVersionIteration> <PreReleaseVersionIteration>1</PreReleaseVersionIteration>

@ -1,6 +1,6 @@
{ {
"sdk": { "sdk": {
"version": "5.0.203", "version": "6.0.100",
"allowPrerelease": false, "allowPrerelease": false,
"rollForward": "latestFeature" "rollForward": "latestFeature"
} }

@ -2,7 +2,7 @@
<PropertyGroup> <PropertyGroup>
<Description>Jet/ACE data provider for .NET used by EntityFramworkCore.Jet (Microsoft Access MDB/ACCDB files).</Description> <Description>Jet/ACE data provider for .NET used by EntityFramworkCore.Jet (Microsoft Access MDB/ACCDB files).</Description>
<TargetFramework>$(DefaultNetStandardTargetFramework)</TargetFramework> <TargetFramework>net6.0-windows</TargetFramework>
<Platforms>AnyCPU;x86;x64</Platforms> <Platforms>AnyCPU;x86;x64</Platforms>
<AssemblyName>EntityFrameworkCore.Jet.Data</AssemblyName> <AssemblyName>EntityFrameworkCore.Jet.Data</AssemblyName>
<RootNamespace>EntityFrameworkCore.Jet.Data</RootNamespace> <RootNamespace>EntityFrameworkCore.Jet.Data</RootNamespace>

@ -2,7 +2,7 @@
<PropertyGroup> <PropertyGroup>
<Description>Explicit ODBC support for Jet/ACE database provider for Entity Framework Core (Microsoft Access MDB/ACCDB files).</Description> <Description>Explicit ODBC support for Jet/ACE database provider for Entity Framework Core (Microsoft Access MDB/ACCDB files).</Description>
<TargetFramework>$(WindowsOnlyNetCoreTargetFramework)</TargetFramework> <TargetFramework>net6.0-windows</TargetFramework>
<AssemblyName>EntityFrameworkCore.Jet.Odbc</AssemblyName> <AssemblyName>EntityFrameworkCore.Jet.Odbc</AssemblyName>
<RootNamespace>EntityFrameworkCore.Jet</RootNamespace> <RootNamespace>EntityFrameworkCore.Jet</RootNamespace>
<PackageTags>$(PackageTags);ODBC;System.Data.Odbc</PackageTags> <PackageTags>$(PackageTags);ODBC;System.Data.Odbc</PackageTags>

@ -2,7 +2,7 @@
<PropertyGroup> <PropertyGroup>
<Description>Explicit OLE DB support for Jet/ACE database provider for Entity Framework Core (Microsoft Access MDB/ACCDB files).</Description> <Description>Explicit OLE DB support for Jet/ACE database provider for Entity Framework Core (Microsoft Access MDB/ACCDB files).</Description>
<TargetFramework>$(WindowsOnlyNetCoreTargetFramework)</TargetFramework> <TargetFramework>net6.0-windows</TargetFramework>
<AssemblyName>EntityFrameworkCore.Jet.OleDb</AssemblyName> <AssemblyName>EntityFrameworkCore.Jet.OleDb</AssemblyName>
<RootNamespace>EntityFrameworkCore.Jet</RootNamespace> <RootNamespace>EntityFrameworkCore.Jet</RootNamespace>
<PackageTags>$(PackageTags);OLE DB;OLEDB;System.Data.OleDb</PackageTags> <PackageTags>$(PackageTags);OLE DB;OLEDB;System.Data.OleDb</PackageTags>

@ -2,7 +2,7 @@
<PropertyGroup> <PropertyGroup>
<Description>Jet/ACE database provider for Entity Framework Core (Microsoft Access MDB/ACCDB files).</Description> <Description>Jet/ACE database provider for Entity Framework Core (Microsoft Access MDB/ACCDB files).</Description>
<TargetFramework>$(DefaultNetStandardTargetFramework)</TargetFramework> <TargetFramework>net6.0-windows</TargetFramework>
<RootNamespace>EntityFrameworkCore.Jet</RootNamespace> <RootNamespace>EntityFrameworkCore.Jet</RootNamespace>
<AssemblyName>EntityFrameworkCore.Jet</AssemblyName> <AssemblyName>EntityFrameworkCore.Jet</AssemblyName>
<Platforms>AnyCPU;x86;x64</Platforms> <Platforms>AnyCPU;x86;x64</Platforms>

@ -15,7 +15,7 @@ namespace Microsoft.EntityFrameworkCore
/// </summary> /// </summary>
/// <param name="model"> The model. </param> /// <param name="model"> The model. </param>
/// <returns> The default identity seed. </returns> /// <returns> The default identity seed. </returns>
public static int GetIdentitySeed([NotNull] this IModel model) public static int GetIdentitySeed([NotNull] this IReadOnlyModel model)
=> (int?) model[JetAnnotationNames.IdentitySeed] ?? 1; => (int?) model[JetAnnotationNames.IdentitySeed] ?? 1;
/// <summary> /// <summary>
@ -53,7 +53,7 @@ namespace Microsoft.EntityFrameworkCore
/// </summary> /// </summary>
/// <param name="model"> The model. </param> /// <param name="model"> The model. </param>
/// <returns> The default identity increment. </returns> /// <returns> The default identity increment. </returns>
public static int GetIdentityIncrement([NotNull] this IModel model) public static int GetIdentityIncrement([NotNull] this IReadOnlyModel model)
=> (int?) model[JetAnnotationNames.IdentityIncrement] ?? 1; => (int?) model[JetAnnotationNames.IdentityIncrement] ?? 1;
/// <summary> /// <summary>
@ -93,7 +93,7 @@ namespace Microsoft.EntityFrameworkCore
/// </summary> /// </summary>
/// <param name="model"> The model. </param> /// <param name="model"> The model. </param>
/// <returns> The default <see cref="JetValueGenerationStrategy" />. </returns> /// <returns> The default <see cref="JetValueGenerationStrategy" />. </returns>
public static JetValueGenerationStrategy? GetValueGenerationStrategy([NotNull] this IModel model) public static JetValueGenerationStrategy? GetValueGenerationStrategy([NotNull] this IReadOnlyModel model)
=> (JetValueGenerationStrategy?) model[JetAnnotationNames.ValueGenerationStrategy]; => (JetValueGenerationStrategy?) model[JetAnnotationNames.ValueGenerationStrategy];
/// <summary> /// <summary>

@ -22,7 +22,7 @@ namespace Microsoft.EntityFrameworkCore
/// </summary> /// </summary>
/// <param name="property"> The property. </param> /// <param name="property"> The property. </param>
/// <returns> The identity seed. </returns> /// <returns> The identity seed. </returns>
public static int? GetIdentitySeed([NotNull] this IProperty property) public static int? GetIdentitySeed([NotNull] this IReadOnlyProperty property)
=> (int?)property[JetAnnotationNames.IdentitySeed]; => (int?)property[JetAnnotationNames.IdentitySeed];
/// <summary> /// <summary>
@ -31,7 +31,7 @@ namespace Microsoft.EntityFrameworkCore
/// <param name="property"> The property. </param> /// <param name="property"> The property. </param>
/// <param name="storeObject"> The identifier of the store object. </param> /// <param name="storeObject"> The identifier of the store object. </param>
/// <returns> The identity seed. </returns> /// <returns> The identity seed. </returns>
public static int? GetIdentitySeed([NotNull] this IProperty property, in StoreObjectIdentifier storeObject) public static int? GetIdentitySeed([NotNull] this IReadOnlyProperty property, in StoreObjectIdentifier storeObject)
{ {
var annotation = property.FindAnnotation(JetAnnotationNames.IdentitySeed); var annotation = property.FindAnnotation(JetAnnotationNames.IdentitySeed);
if (annotation != null) if (annotation != null)
@ -88,7 +88,7 @@ namespace Microsoft.EntityFrameworkCore
/// </summary> /// </summary>
/// <param name="property"> The property. </param> /// <param name="property"> The property. </param>
/// <returns> The identity increment. </returns> /// <returns> The identity increment. </returns>
public static int? GetIdentityIncrement([NotNull] this IProperty property) public static int? GetIdentityIncrement([NotNull] this IReadOnlyProperty property)
=> (int?)property[JetAnnotationNames.IdentityIncrement]; => (int?)property[JetAnnotationNames.IdentityIncrement];
/// <summary> /// <summary>
@ -97,7 +97,7 @@ namespace Microsoft.EntityFrameworkCore
/// <param name="property"> The property. </param> /// <param name="property"> The property. </param>
/// <param name="storeObject"> The identifier of the store object. </param> /// <param name="storeObject"> The identifier of the store object. </param>
/// <returns> The identity increment. </returns> /// <returns> The identity increment. </returns>
public static int? GetIdentityIncrement([NotNull] this IProperty property, in StoreObjectIdentifier storeObject) public static int? GetIdentityIncrement([NotNull] this IReadOnlyProperty property, in StoreObjectIdentifier storeObject)
{ {
var annotation = property.FindAnnotation(JetAnnotationNames.IdentityIncrement); var annotation = property.FindAnnotation(JetAnnotationNames.IdentityIncrement);
if (annotation != null) if (annotation != null)
@ -159,7 +159,7 @@ namespace Microsoft.EntityFrameworkCore
/// </summary> /// </summary>
/// <param name="property"> The property. </param> /// <param name="property"> The property. </param>
/// <returns> The strategy, or <see cref="JetValueGenerationStrategy.None" /> if none was set. </returns> /// <returns> The strategy, or <see cref="JetValueGenerationStrategy.None" /> if none was set. </returns>
public static JetValueGenerationStrategy GetValueGenerationStrategy([NotNull] this IProperty property) public static JetValueGenerationStrategy GetValueGenerationStrategy([NotNull] this IReadOnlyProperty property)
{ {
var annotation = property.FindAnnotation(JetAnnotationNames.ValueGenerationStrategy); var annotation = property.FindAnnotation(JetAnnotationNames.ValueGenerationStrategy);
if (annotation != null) if (annotation != null)
@ -190,7 +190,7 @@ namespace Microsoft.EntityFrameworkCore
/// <param name="storeObject"> The identifier of the store object. </param> /// <param name="storeObject"> The identifier of the store object. </param>
/// <returns> The strategy, or <see cref="JetValueGenerationStrategy.None" /> if none was set. </returns> /// <returns> The strategy, or <see cref="JetValueGenerationStrategy.None" /> if none was set. </returns>
public static JetValueGenerationStrategy GetValueGenerationStrategy( public static JetValueGenerationStrategy GetValueGenerationStrategy(
[NotNull] this IProperty property, [NotNull] this IReadOnlyProperty property,
in StoreObjectIdentifier storeObject) in StoreObjectIdentifier storeObject)
{ {
var annotation = property.FindAnnotation(JetAnnotationNames.ValueGenerationStrategy); var annotation = property.FindAnnotation(JetAnnotationNames.ValueGenerationStrategy);
@ -220,7 +220,7 @@ namespace Microsoft.EntityFrameworkCore
return GetDefaultValueGenerationStrategy(property); return GetDefaultValueGenerationStrategy(property);
} }
private static JetValueGenerationStrategy GetDefaultValueGenerationStrategy(IProperty property) private static JetValueGenerationStrategy GetDefaultValueGenerationStrategy(IReadOnlyProperty property)
{ {
var modelStrategy = property.DeclaringEntityType.Model.GetValueGenerationStrategy(); var modelStrategy = property.DeclaringEntityType.Model.GetValueGenerationStrategy();
@ -262,7 +262,7 @@ namespace Microsoft.EntityFrameworkCore
return value; return value;
} }
private static void CheckValueGenerationStrategy(IProperty property, JetValueGenerationStrategy? value) private static void CheckValueGenerationStrategy(IReadOnlyProperty property, JetValueGenerationStrategy? value)
{ {
if (value != null) if (value != null)
{ {
@ -292,7 +292,7 @@ namespace Microsoft.EntityFrameworkCore
/// </summary> /// </summary>
/// <param name="property"> The property. </param> /// <param name="property"> The property. </param>
/// <returns> <c>true</c> if compatible. </returns> /// <returns> <c>true</c> if compatible. </returns>
public static bool IsCompatibleWithValueGeneration([NotNull] IProperty property) public static bool IsCompatibleWithValueGeneration([NotNull] IReadOnlyProperty property)
{ {
var type = property.ClrType; var type = property.ClrType;

@ -175,7 +175,7 @@ namespace EntityFrameworkCore.Jet.Infrastructure.Internal
private sealed class ExtensionInfo : RelationalExtensionInfo private sealed class ExtensionInfo : RelationalExtensionInfo
{ {
private long? _serviceProviderHash; private int? _serviceProviderHash;
private string _logFragment; private string _logFragment;
public ExtensionInfo(IDbContextOptionsExtension extension) public ExtensionInfo(IDbContextOptionsExtension extension)
@ -227,12 +227,12 @@ namespace EntityFrameworkCore.Jet.Infrastructure.Internal
} }
} }
public override long GetServiceProviderHashCode() public override int GetServiceProviderHashCode()
{ {
if (_serviceProviderHash == null) if (_serviceProviderHash == null)
{ {
_serviceProviderHash = (base.GetServiceProviderHashCode() * 397) ^ _serviceProviderHash = (base.GetServiceProviderHashCode() * 397) ^
(Extension._dataAccessProviderFactory?.GetHashCode() ?? 0L) ^ (Extension._dataAccessProviderFactory?.GetHashCode() ?? 0) ^
(Extension._useOuterSelectSkipEmulationViaDataReader.GetHashCode() * 397) ^ (Extension._useOuterSelectSkipEmulationViaDataReader.GetHashCode() * 397) ^
(Extension._enableMillisecondsSupport.GetHashCode() * 397)/* ^ (Extension._enableMillisecondsSupport.GetHashCode() * 397)/* ^
(Extension._rowNumberPaging?.GetHashCode() ?? 0L)*/; (Extension._rowNumberPaging?.GetHashCode() ?? 0L)*/;

@ -91,12 +91,12 @@ namespace EntityFrameworkCore.Jet.Internal
&& (ConfigurationSource.Convention.Overrides(property.GetPrecisionConfigurationSource()) && (ConfigurationSource.Convention.Overrides(property.GetPrecisionConfigurationSource())
|| ConfigurationSource.Convention.Overrides(property.GetScaleConfigurationSource()))) || ConfigurationSource.Convention.Overrides(property.GetScaleConfigurationSource())))
{ {
logger.DecimalTypeDefaultWarning(property); logger.DecimalTypeDefaultWarning((IProperty)property);
} }
if (property.IsKey()) if (property.IsKey())
{ {
logger.DecimalTypeKeyWarning(property); logger.DecimalTypeKeyWarning((IProperty)property);
} }
} }
} }

@ -82,7 +82,7 @@ namespace Microsoft.EntityFrameworkCore.Metadata.Conventions
} }
} }
static bool IsStrategyNoneNeeded(IProperty property, StoreObjectIdentifier storeObject) static bool IsStrategyNoneNeeded(IReadOnlyProperty property, StoreObjectIdentifier storeObject)
{ {
if (property.ValueGenerated == ValueGenerated.OnAdd if (property.ValueGenerated == ValueGenerated.OnAdd
&& property.GetDefaultValue(storeObject) == null && property.GetDefaultValue(storeObject) == null

@ -75,7 +75,7 @@ namespace Microsoft.EntityFrameworkCore.Metadata.Conventions
/// <param name="property"> The property. </param> /// <param name="property"> The property. </param>
/// <param name="storeObject"> The identifier of the store object. </param> /// <param name="storeObject"> The identifier of the store object. </param>
/// <returns> The store value generation strategy to set for the given property. </returns> /// <returns> The store value generation strategy to set for the given property. </returns>
public static new ValueGenerated? GetValueGenerated([NotNull] IProperty property, in StoreObjectIdentifier storeObject) public static ValueGenerated? GetValueGenerated([NotNull] IProperty property, in StoreObjectIdentifier storeObject)
=> RelationalValueGenerationConvention.GetValueGenerated(property, storeObject) => RelationalValueGenerationConvention.GetValueGenerated(property, storeObject)
?? (property.GetValueGenerationStrategy(storeObject) != JetValueGenerationStrategy.None ?? (property.GetValueGenerationStrategy(storeObject) != JetValueGenerationStrategy.None
? ValueGenerated.OnAdd ? ValueGenerated.OnAdd

@ -37,7 +37,6 @@ namespace EntityFrameworkCore.Jet.Query.Sql.Internal
private readonly ITypeMappingSource _typeMappingSource; private readonly ITypeMappingSource _typeMappingSource;
private readonly IJetOptions _options; private readonly IJetOptions _options;
private readonly JetSqlExpressionFactory _sqlExpressionFactory;
private readonly ISqlGenerationHelper _sqlGenerationHelper; private readonly ISqlGenerationHelper _sqlGenerationHelper;
private CoreTypeMapping _boolTypeMapping; private CoreTypeMapping _boolTypeMapping;
@ -47,12 +46,10 @@ namespace EntityFrameworkCore.Jet.Query.Sql.Internal
/// </summary> /// </summary>
public JetQuerySqlGenerator( public JetQuerySqlGenerator(
[NotNull] QuerySqlGeneratorDependencies dependencies, [NotNull] QuerySqlGeneratorDependencies dependencies,
ISqlExpressionFactory sqlExpressionFactory,
ITypeMappingSource typeMappingSource, ITypeMappingSource typeMappingSource,
IJetOptions options) IJetOptions options)
: base(dependencies) : base(dependencies)
{ {
_sqlExpressionFactory = (JetSqlExpressionFactory) sqlExpressionFactory;
_typeMappingSource = typeMappingSource; _typeMappingSource = typeMappingSource;
_options = options; _options = options;
_sqlGenerationHelper = dependencies.SqlGenerationHelper; _sqlGenerationHelper = dependencies.SqlGenerationHelper;
@ -250,11 +247,12 @@ namespace EntityFrameworkCore.Jet.Query.Sql.Internal
return base.VisitOrdering(orderingExpression); return base.VisitOrdering(orderingExpression);
} }
protected override Expression VisitSqlBinary(SqlBinaryExpression sqlBinaryExpression) protected override Expression VisitSqlBinary(SqlBinaryExpression sqlBinaryExpression)
{ {
Check.NotNull(sqlBinaryExpression, nameof(sqlBinaryExpression)); Check.NotNull(sqlBinaryExpression, nameof(sqlBinaryExpression));
if (sqlBinaryExpression.OperatorType == ExpressionType.Coalesce) /*if (sqlBinaryExpression.OperatorType == ExpressionType.Coalesce)
{ {
Visit( Visit(
_sqlExpressionFactory.Case( _sqlExpressionFactory.Case(
@ -266,7 +264,7 @@ namespace EntityFrameworkCore.Jet.Query.Sql.Internal
}, },
sqlBinaryExpression.Left)); sqlBinaryExpression.Left));
return sqlBinaryExpression; return sqlBinaryExpression;
} }*/
return base.VisitSqlBinary(sqlBinaryExpression); return base.VisitSqlBinary(sqlBinaryExpression);
} }
@ -288,7 +286,7 @@ namespace EntityFrameworkCore.Jet.Query.Sql.Internal
// of the returned value using a different (unaligned) type mapping (e.g. date/time related ones). // of the returned value using a different (unaligned) type mapping (e.g. date/time related ones).
if (_convertMappings.TryGetValue(convertExpression.Type.Name, out var function)) if (_convertMappings.TryGetValue(convertExpression.Type.Name, out var function))
{ {
Visit( /*Visit(
_sqlExpressionFactory.NullChecked( _sqlExpressionFactory.NullChecked(
convertExpression.Operand, convertExpression.Operand,
_sqlExpressionFactory.Function( _sqlExpressionFactory.Function(
@ -297,7 +295,7 @@ namespace EntityFrameworkCore.Jet.Query.Sql.Internal
false, false,
new[] {false}, new[] {false},
typeMapping.ClrType))); typeMapping.ClrType)));
*/
return convertExpression; return convertExpression;
} }
@ -322,10 +320,6 @@ namespace EntityFrameworkCore.Jet.Query.Sql.Internal
protected override Expression VisitLike(LikeExpression likeExpression) protected override Expression VisitLike(LikeExpression likeExpression)
{ {
Check.NotNull(likeExpression, nameof(likeExpression)); Check.NotNull(likeExpression, nameof(likeExpression));
if (likeExpression.EscapeChar != null)
base.VisitLike(_sqlExpressionFactory.Like(likeExpression.Match, likeExpression.Pattern));
else
base.VisitLike(likeExpression); base.VisitLike(likeExpression);
return likeExpression; return likeExpression;
@ -447,5 +441,7 @@ namespace EntityFrameworkCore.Jet.Query.Sql.Internal
protected override Expression VisitRowNumber(RowNumberExpression rowNumberExpression) protected override Expression VisitRowNumber(RowNumberExpression rowNumberExpression)
=> throw new InvalidOperationException(CoreStrings.TranslationFailed(rowNumberExpression)); => throw new InvalidOperationException(CoreStrings.TranslationFailed(rowNumberExpression));
} }
} }

@ -14,7 +14,6 @@ namespace EntityFrameworkCore.Jet.Query.Sql.Internal
public class JetQuerySqlGeneratorFactory : IQuerySqlGeneratorFactory public class JetQuerySqlGeneratorFactory : IQuerySqlGeneratorFactory
{ {
[NotNull] private readonly QuerySqlGeneratorDependencies _dependencies; [NotNull] private readonly QuerySqlGeneratorDependencies _dependencies;
[NotNull] private readonly JetSqlExpressionFactory _sqlExpressionFactory;
[NotNull] private readonly ITypeMappingSource _typeMappingSource; [NotNull] private readonly ITypeMappingSource _typeMappingSource;
[NotNull] private readonly IJetOptions _options; [NotNull] private readonly IJetOptions _options;
@ -24,17 +23,15 @@ namespace EntityFrameworkCore.Jet.Query.Sql.Internal
/// </summary> /// </summary>
public JetQuerySqlGeneratorFactory( public JetQuerySqlGeneratorFactory(
[NotNull] QuerySqlGeneratorDependencies dependencies, [NotNull] QuerySqlGeneratorDependencies dependencies,
[NotNull] ISqlExpressionFactory sqlExpressionFactory,
[NotNull] ITypeMappingSource typeMappingSource, [NotNull] ITypeMappingSource typeMappingSource,
[NotNull] IJetOptions options) [NotNull] IJetOptions options)
{ {
_dependencies = dependencies; _dependencies = dependencies;
_sqlExpressionFactory = (JetSqlExpressionFactory)sqlExpressionFactory;
_typeMappingSource = typeMappingSource; _typeMappingSource = typeMappingSource;
_options = options; _options = options;
} }
public virtual QuerySqlGenerator Create() public virtual QuerySqlGenerator Create()
=> new JetQuerySqlGenerator(_dependencies, _sqlExpressionFactory, _typeMappingSource, _options); => new JetQuerySqlGenerator(_dependencies, _typeMappingSource, _options);
} }
} }

@ -1,5 +1,8 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Reflection;
using EntityFrameworkCore.Jet.Infrastructure;
using JetBrains.Annotations; using JetBrains.Annotations;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Design; using Microsoft.EntityFrameworkCore.Design;
@ -15,6 +18,12 @@ namespace EntityFrameworkCore.Jet.Scaffolding.Internal
/// </summary> /// </summary>
public class JetCodeGenerator : ProviderCodeGenerator public class JetCodeGenerator : ProviderCodeGenerator
{ {
private static readonly MethodInfo _useJetMethodInfo
= typeof(JetDbContextOptionsBuilderExtensions).GetRequiredRuntimeMethod(
nameof(JetDbContextOptionsBuilderExtensions.UseJet),
typeof(DbContextOptionsBuilder),
typeof(string),
typeof(Action<JetDbContextOptionsBuilder>));
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="JetCodeGenerator" /> class. /// Initializes a new instance of the <see cref="JetCodeGenerator" /> class.
/// </summary> /// </summary>
@ -33,8 +42,7 @@ namespace EntityFrameworkCore.Jet.Scaffolding.Internal
public override MethodCallCodeFragment GenerateUseProvider( public override MethodCallCodeFragment GenerateUseProvider(
string connectionString, string connectionString,
MethodCallCodeFragment providerOptions) MethodCallCodeFragment providerOptions)
=> new MethodCallCodeFragment( => new(_useJetMethodInfo,
nameof(JetDbContextOptionsBuilderExtensions.UseJet),
providerOptions == null providerOptions == null
? new object[] { connectionString } ? new object[] { connectionString }
: new object[] { connectionString, new NestedClosureCodeFragment("x", providerOptions) }); : new object[] { connectionString, new NestedClosureCodeFragment("x", providerOptions) });

@ -57,8 +57,7 @@ namespace EntityFrameworkCore.Jet.Storage.Internal
/// </summary> /// </summary>
public override bool HasTables() public override bool HasTables()
{ {
return Dependencies.ExecutionStrategyFactory return Dependencies.ExecutionStrategy
.Create()
.Execute( .Execute(
_relationalConnection, _relationalConnection,
connection => connection =>
@ -82,7 +81,7 @@ namespace EntityFrameworkCore.Jet.Storage.Internal
/// doing so can result in application failures when updating to a new Entity Framework Core release. /// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary> /// </summary>
public override Task<bool> HasTablesAsync(CancellationToken cancellationToken = default) public override Task<bool> HasTablesAsync(CancellationToken cancellationToken = default)
=> Dependencies.ExecutionStrategyFactory.Create().ExecuteAsync( => Dependencies.ExecutionStrategy.ExecuteAsync(
_relationalConnection, _relationalConnection,
async (connection, ct) => async (connection, ct) =>
{ {

@ -65,7 +65,7 @@ namespace EntityFrameworkCore.Jet.Storage.Internal
.UseJet(connection, b => b.CommandTimeout(CommandTimeout ?? DefaultMasterConnectionCommandTimeout)) .UseJet(connection, b => b.CommandTimeout(CommandTimeout ?? DefaultMasterConnectionCommandTimeout))
.Options; .Options;
return new JetRelationalConnection(Dependencies.With(contextOptions)); return new JetRelationalConnection(Dependencies with { ContextOptions = contextOptions });
} }
/// <summary> /// <summary>

@ -35,7 +35,7 @@ namespace EntityFrameworkCore.Jet.Update.Internal
/// any release. You should only use it directly in your code with extreme caution and knowing that /// 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. /// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary> /// </summary>
protected override bool CanAddCommand(ModificationCommand modificationCommand) protected override bool CanAddCommand(IReadOnlyModificationCommand modificationCommand)
=> ModificationCommands.Count < MaxRowCount; => ModificationCommands.Count < MaxRowCount;
/// <summary> /// <summary>

@ -36,7 +36,7 @@ namespace EntityFrameworkCore.Jet.Update.Internal
/// any release. You should only use it directly in your code with extreme caution and knowing that /// 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. /// doing so can result in application failures when updating to a new Entity Framework Core release.
/// </summary> /// </summary>
protected override void AppendIdentityWhereCondition(StringBuilder commandStringBuilder, ColumnModification columnModification) protected override void AppendIdentityWhereCondition(StringBuilder commandStringBuilder, IColumnModification columnModification)
{ {
SqlGenerationHelper.DelimitIdentifier(commandStringBuilder, columnModification.ColumnName); SqlGenerationHelper.DelimitIdentifier(commandStringBuilder, columnModification.ColumnName);
commandStringBuilder.Append(" = "); commandStringBuilder.Append(" = ");

@ -54,6 +54,51 @@ namespace System
return props.SingleOrDefault(); return props.SingleOrDefault();
} }
public static MethodInfo GetRequiredMethod(this Type type, string name, params Type[] parameters)
{
var method = type.GetTypeInfo().GetMethod(name, parameters);
if (method == null
&& parameters.Length == 0)
{
method = type.GetMethod(name);
}
if (method == null)
{
throw new InvalidOperationException();
}
return method;
}
public static PropertyInfo GetRequiredProperty(this Type type, string name)
=> type.GetTypeInfo().GetProperty(name)
?? throw new InvalidOperationException($"Could not find property '{name}' on type '{type}'");
public static FieldInfo GetRequiredDeclaredField(this Type type, string name)
=> type.GetTypeInfo().GetDeclaredField(name)
?? throw new InvalidOperationException($"Could not find field '{name}' on type '{type}'");
public static MethodInfo GetRequiredDeclaredMethod(this Type type, string name)
=> type.GetTypeInfo().GetDeclaredMethod(name)
?? throw new InvalidOperationException($"Could not find method '{name}' on type '{type}'");
public static MethodInfo GetRequiredDeclaredMethod(this Type type, string name, Func<MethodInfo, bool> methodSelector)
=> type.GetTypeInfo().GetDeclaredMethods(name).Single(methodSelector);
public static PropertyInfo GetRequiredDeclaredProperty(this Type type, string name)
=> type.GetTypeInfo().GetDeclaredProperty(name)
?? throw new InvalidOperationException($"Could not find property '{name}' on type '{type}'");
public static MethodInfo GetRequiredRuntimeMethod(this Type type, string name, params Type[] parameters)
=> type.GetTypeInfo().GetRuntimeMethod(name, parameters)
?? throw new InvalidOperationException($"Could not find method '{name}' on type '{type}'");
public static PropertyInfo GetRequiredRuntimeProperty(this Type type, string name)
=> type.GetTypeInfo().GetRuntimeProperty(name)
?? throw new InvalidOperationException($"Could not find property '{name}' on type '{type}'");
public static bool IsInstantiable(this Type type) => IsInstantiable(type.GetTypeInfo()); public static bool IsInstantiable(this Type type) => IsInstantiable(type.GetTypeInfo());
private static bool IsInstantiable(TypeInfo type) private static bool IsInstantiable(TypeInfo type)

Loading…
Cancel
Save