Upgrade sql update generation files to 3.1.x.
parent
6e8cc34c72
commit
70f2b880ca
@ -1,68 +1,59 @@
|
||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||
|
||||
using System;
|
||||
using JetBrains.Annotations;
|
||||
using Microsoft.EntityFrameworkCore.Storage;
|
||||
using Microsoft.EntityFrameworkCore.Update;
|
||||
|
||||
namespace EntityFrameworkCore.Jet.Update.Internal
|
||||
{
|
||||
/// <summary>
|
||||
/// This API supports the Entity Framework Core infrastructure and is not intended to be used
|
||||
/// directly from your code. This API may change or be removed in future releases.
|
||||
/// 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 class JetModificationCommandBatch : AffectedCountModificationCommandBatch
|
||||
{
|
||||
private int _parameterCount = 1; // Implicit parameter for the command text
|
||||
private const int MaxRowCount = 1;
|
||||
|
||||
/// <summary>
|
||||
/// This API supports the Entity Framework Core infrastructure and is not intended to be used
|
||||
/// directly from your code. This API may change or be removed in future releases.
|
||||
/// 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 JetModificationCommandBatch(
|
||||
[NotNull] IRelationalCommandBuilderFactory commandBuilderFactory,
|
||||
[NotNull] ISqlGenerationHelper sqlGenerationHelper,
|
||||
// ReSharper disable once SuggestBaseTypeForParameter
|
||||
[NotNull] IJetUpdateSqlGenerator updateSqlGenerator,
|
||||
[NotNull] IRelationalValueBufferFactoryFactory valueBufferFactoryFactory)
|
||||
: base(
|
||||
commandBuilderFactory,
|
||||
sqlGenerationHelper,
|
||||
updateSqlGenerator,
|
||||
valueBufferFactoryFactory)
|
||||
[NotNull] ModificationCommandBatchFactoryDependencies dependencies)
|
||||
: base(dependencies)
|
||||
{
|
||||
// See https://support.office.com/en-us/article/access-specifications-0cf3c66f-9cf2-4e32-9568-98c1025bb47c
|
||||
// for Access specifications and limits.
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This API supports the Entity Framework Core infrastructure and is not intended to be used
|
||||
/// directly from your code. This API may change or be removed in future releases.
|
||||
/// </summary>
|
||||
protected new virtual IJetUpdateSqlGenerator UpdateSqlGenerator => (IJetUpdateSqlGenerator)base.UpdateSqlGenerator;
|
||||
|
||||
/// <summary>
|
||||
/// This API supports the Entity Framework Core infrastructure and is not intended to be used
|
||||
/// directly from your code. This API may change or be removed in future releases.
|
||||
/// 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>
|
||||
protected override bool CanAddCommand(ModificationCommand modificationCommand)
|
||||
{
|
||||
return ModificationCommands.Count == 0;
|
||||
}
|
||||
=> ModificationCommands.Count < MaxRowCount;
|
||||
|
||||
/// <summary>
|
||||
/// This API supports the Entity Framework Core infrastructure and is not intended to be used
|
||||
/// directly from your code. This API may change or be removed in future releases.
|
||||
/// 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>
|
||||
protected override bool IsCommandTextValid()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
=> true;
|
||||
|
||||
/// <summary>
|
||||
/// This API supports the Entity Framework Core infrastructure and is not intended to be used
|
||||
/// directly from your code. This API may change or be removed in future releases.
|
||||
/// 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>
|
||||
protected override int GetParameterCount()
|
||||
=> _parameterCount;
|
||||
|
||||
=> 1;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,64 +1,53 @@
|
||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||
|
||||
using System.Linq;
|
||||
using EntityFrameworkCore.Jet.Infrastructure.Internal;
|
||||
using JetBrains.Annotations;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Storage;
|
||||
using Microsoft.EntityFrameworkCore.Update;
|
||||
using EntityFrameworkCore.Jet.Utilities;
|
||||
|
||||
namespace EntityFrameworkCore.Jet.Update.Internal
|
||||
{
|
||||
/// <summary>
|
||||
/// This API supports the Entity Framework Core infrastructure and is not intended to be used
|
||||
/// directly from your code. This API may change or be removed in future releases.
|
||||
/// <para>
|
||||
/// 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.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// The service lifetime is <see cref="ServiceLifetime.Scoped" />. This means that each
|
||||
/// <see cref="DbContext" /> instance will use its own instance of this service.
|
||||
/// The implementation may depend on other services registered with any lifetime.
|
||||
/// The implementation does not need to be thread-safe.
|
||||
/// </para>
|
||||
/// </summary>
|
||||
public class JetModificationCommandBatchFactory : IModificationCommandBatchFactory
|
||||
{
|
||||
private readonly IRelationalCommandBuilderFactory _commandBuilderFactory;
|
||||
private readonly ISqlGenerationHelper _sqlGenerationHelper;
|
||||
private readonly IJetUpdateSqlGenerator _updateSqlGenerator;
|
||||
private readonly IRelationalValueBufferFactoryFactory _valueBufferFactoryFactory;
|
||||
private readonly IDbContextOptions _options;
|
||||
private readonly ModificationCommandBatchFactoryDependencies _dependencies;
|
||||
|
||||
/// <summary>
|
||||
/// This API supports the Entity Framework Core infrastructure and is not intended to be used
|
||||
/// directly from your code. This API may change or be removed in future releases.
|
||||
/// 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 JetModificationCommandBatchFactory(
|
||||
[NotNull] IRelationalCommandBuilderFactory commandBuilderFactory,
|
||||
[NotNull] ISqlGenerationHelper sqlGenerationHelper,
|
||||
[NotNull] IJetUpdateSqlGenerator updateSqlGenerator,
|
||||
[NotNull] IRelationalValueBufferFactoryFactory valueBufferFactoryFactory,
|
||||
[NotNull] ModificationCommandBatchFactoryDependencies dependencies,
|
||||
[NotNull] IDbContextOptions options)
|
||||
{
|
||||
Check.NotNull(commandBuilderFactory, nameof(commandBuilderFactory));
|
||||
Check.NotNull(sqlGenerationHelper, nameof(sqlGenerationHelper));
|
||||
Check.NotNull(updateSqlGenerator, nameof(updateSqlGenerator));
|
||||
Check.NotNull(valueBufferFactoryFactory, nameof(valueBufferFactoryFactory));
|
||||
Check.NotNull(dependencies, nameof(dependencies));
|
||||
Check.NotNull(options, nameof(options));
|
||||
|
||||
_commandBuilderFactory = commandBuilderFactory;
|
||||
_sqlGenerationHelper = sqlGenerationHelper;
|
||||
_updateSqlGenerator = updateSqlGenerator;
|
||||
_valueBufferFactoryFactory = valueBufferFactoryFactory;
|
||||
_options = options;
|
||||
_dependencies = dependencies;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This API supports the Entity Framework Core infrastructure and is not intended to be used
|
||||
/// directly from your code. This API may change or be removed in future releases.
|
||||
/// 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 virtual ModificationCommandBatch Create()
|
||||
{
|
||||
var optionsExtension = _options.Extensions.OfType<JetOptionsExtension>().FirstOrDefault();
|
||||
|
||||
return new JetModificationCommandBatch(
|
||||
_commandBuilderFactory,
|
||||
_sqlGenerationHelper,
|
||||
_updateSqlGenerator,
|
||||
_valueBufferFactoryFactory);
|
||||
}
|
||||
=> new JetModificationCommandBatch(_dependencies);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue