diff --git a/src/EFCore.Jet/Update/Internal/IJetUpdateSqlGenerator.cs b/src/EFCore.Jet/Update/Internal/IJetUpdateSqlGenerator.cs
index 702e6b7..adfcce8 100644
--- a/src/EFCore.Jet/Update/Internal/IJetUpdateSqlGenerator.cs
+++ b/src/EFCore.Jet/Update/Internal/IJetUpdateSqlGenerator.cs
@@ -1,15 +1,21 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-using System.Collections.Generic;
-using System.Text;
-using JetBrains.Annotations;
using Microsoft.EntityFrameworkCore.Update;
namespace EntityFrameworkCore.Jet.Update.Internal
{
///
- /// 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.
+ ///
+ ///
+ /// The service lifetime is . This means a single instance
+ /// is used by many instances. The implementation must be thread-safe.
+ /// This service cannot depend on services registered as .
+ ///
///
public interface IJetUpdateSqlGenerator : IUpdateSqlGenerator
{
diff --git a/src/EFCore.Jet/Update/Internal/JetModificationCommandBatch.cs b/src/EFCore.Jet/Update/Internal/JetModificationCommandBatch.cs
index d8d4070..7e63ed2 100644
--- a/src/EFCore.Jet/Update/Internal/JetModificationCommandBatch.cs
+++ b/src/EFCore.Jet/Update/Internal/JetModificationCommandBatch.cs
@@ -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
{
///
- /// 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.
///
public class JetModificationCommandBatch : AffectedCountModificationCommandBatch
{
- private int _parameterCount = 1; // Implicit parameter for the command text
+ private const int MaxRowCount = 1;
///
- /// 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.
///
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.
}
///
- /// 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.
- ///
- protected new virtual IJetUpdateSqlGenerator UpdateSqlGenerator => (IJetUpdateSqlGenerator)base.UpdateSqlGenerator;
-
- ///
- /// 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.
///
protected override bool CanAddCommand(ModificationCommand modificationCommand)
- {
- return ModificationCommands.Count == 0;
- }
+ => ModificationCommands.Count < MaxRowCount;
///
- /// 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.
///
protected override bool IsCommandTextValid()
- {
- return true;
- }
+ => true;
///
- /// 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.
///
protected override int GetParameterCount()
- => _parameterCount;
-
+ => 1;
}
}
diff --git a/src/EFCore.Jet/Update/Internal/JetModificationCommandBatchFactory.cs b/src/EFCore.Jet/Update/Internal/JetModificationCommandBatchFactory.cs
index d80f0e6..d2867da 100644
--- a/src/EFCore.Jet/Update/Internal/JetModificationCommandBatchFactory.cs
+++ b/src/EFCore.Jet/Update/Internal/JetModificationCommandBatchFactory.cs
@@ -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
{
///
- /// 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.
+ ///
+ ///
+ /// The service lifetime is . This means that each
+ /// 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.
+ ///
///
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;
///
- /// 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.
///
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;
}
///
- /// 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.
///
public virtual ModificationCommandBatch Create()
- {
- var optionsExtension = _options.Extensions.OfType().FirstOrDefault();
-
- return new JetModificationCommandBatch(
- _commandBuilderFactory,
- _sqlGenerationHelper,
- _updateSqlGenerator,
- _valueBufferFactoryFactory);
- }
+ => new JetModificationCommandBatch(_dependencies);
}
}
diff --git a/src/EFCore.Jet/Update/Internal/JetUpdateSqlGenerator.cs b/src/EFCore.Jet/Update/Internal/JetUpdateSqlGenerator.cs
index 5f7f745..7c3ce57 100644
--- a/src/EFCore.Jet/Update/Internal/JetUpdateSqlGenerator.cs
+++ b/src/EFCore.Jet/Update/Internal/JetUpdateSqlGenerator.cs
@@ -1,6 +1,5 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-using System;
using System.Text;
using JetBrains.Annotations;
using Microsoft.EntityFrameworkCore.Update;
@@ -8,8 +7,17 @@ using Microsoft.EntityFrameworkCore.Update;
namespace EntityFrameworkCore.Jet.Update.Internal
{
///
- /// 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.
+ ///
+ ///
+ /// The service lifetime is . This means a single instance
+ /// is used by many instances. The implementation must be thread-safe.
+ /// This service cannot depend on services registered as .
+ ///
///
public class JetUpdateSqlGenerator : UpdateSqlGenerator, IJetUpdateSqlGenerator
{
@@ -20,8 +28,10 @@ namespace EntityFrameworkCore.Jet.Update.Internal
}
///
- /// 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.
///
protected override void AppendIdentityWhereCondition(StringBuilder commandStringBuilder, ColumnModification columnModification)
{
@@ -32,11 +42,18 @@ namespace EntityFrameworkCore.Jet.Update.Internal
}
///
- /// 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.
///
protected override void AppendRowsAffectedWhereCondition(StringBuilder commandStringBuilder, int expectedRowsAffected)
{
+ // TODO: Implement translation of @@ROWCOUNT related queries into System.Data.Jet.
+ // Every the AffectedRecords of every NonQueryExecution needs to be saved per connection,
+ // so it can be replaced in later queries if needed.
+ // Other executions should set this saved value just to 0.
+
// Jet does not support ROWCOUNT
// Here we really hope that ROWCOUNT is not required
// Actually, RecordsAffected is handled by JetModificationCommandBatch
@@ -52,9 +69,11 @@ namespace EntityFrameworkCore.Jet.Update.Internal
}
///
- /// 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.
+ /// rom your code. This API may change or be removed in future releases.
protected override ResultSetMapping AppendSelectAffectedCountCommand(StringBuilder commandStringBuilder, string name, string schema, int commandPosition)
{
commandStringBuilder
@@ -64,6 +83,5 @@ namespace EntityFrameworkCore.Jet.Update.Internal
return ResultSetMapping.LastInResultSet;
}
-
}
}