Skip to content

Commit 3b6fee5

Browse files
authored
Disable savepoint API, because it is not supported by Jet. (#126)
1 parent 7214d3c commit 3b6fee5

File tree

3 files changed

+85
-0
lines changed

3 files changed

+85
-0
lines changed

src/EFCore.Jet/Extensions/JetServiceCollectionExtensions.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ public static IServiceCollection AddEntityFrameworkJet([NotNull] this IServiceCo
6161
.TryAdd<IQuerySqlGeneratorFactory, JetQuerySqlGeneratorFactory>()
6262
.TryAdd<ISqlExpressionFactory, JetSqlExpressionFactory>()
6363
.TryAdd<IQueryTranslationPostprocessorFactory, JetQueryTranslationPostprocessorFactory>()
64+
.TryAdd<IRelationalTransactionFactory, JetTransactionFactory>()
6465
.TryAddProviderSpecificServices(
6566
b => b
6667
.TryAddSingleton<IJetOptions, JetOptions>()
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
using System;
2+
using System.Data.Common;
3+
using System.Threading;
4+
using System.Threading.Tasks;
5+
using JetBrains.Annotations;
6+
using Microsoft.EntityFrameworkCore;
7+
using Microsoft.EntityFrameworkCore.Diagnostics;
8+
using Microsoft.EntityFrameworkCore.Storage;
9+
10+
namespace EntityFrameworkCore.Jet.Storage.Internal
11+
{
12+
public class JetTransaction : RelationalTransaction
13+
{
14+
/// <inheritdoc />
15+
public JetTransaction(
16+
[NotNull] IRelationalConnection connection,
17+
[NotNull] DbTransaction transaction,
18+
Guid transactionId,
19+
[NotNull] IDiagnosticsLogger<DbLoggerCategory.Database.Transaction> logger,
20+
bool transactionOwned)
21+
: base(connection, transaction, transactionId, logger, transactionOwned)
22+
{
23+
}
24+
25+
/// <inheritdoc />
26+
public override bool SupportsSavepoints
27+
=> false;
28+
29+
/// <inheritdoc />
30+
public override void CreateSavepoint(string name)
31+
=> throw new NotSupportedException();
32+
33+
/// <inheritdoc />
34+
public override Task CreateSavepointAsync(string name, CancellationToken cancellationToken = new CancellationToken())
35+
=> throw new NotSupportedException();
36+
37+
/// <inheritdoc />
38+
protected override string GetCreateSavepointSql(string name)
39+
=> throw new NotSupportedException();
40+
41+
/// <inheritdoc />
42+
public override void RollbackToSavepoint(string name)
43+
=> throw new NotSupportedException();
44+
45+
/// <inheritdoc />
46+
public override Task RollbackToSavepointAsync(string name, CancellationToken cancellationToken = new CancellationToken())
47+
=> throw new NotSupportedException();
48+
49+
/// <inheritdoc />
50+
protected override string GetRollbackToSavepointSql(string name)
51+
=> throw new NotSupportedException();
52+
53+
/// <inheritdoc />
54+
public override void ReleaseSavepoint(string name)
55+
=> throw new NotSupportedException();
56+
57+
/// <inheritdoc />
58+
public override Task ReleaseSavepointAsync(string name, CancellationToken cancellationToken = default)
59+
=> throw new NotSupportedException();
60+
61+
/// <inheritdoc />
62+
protected override string GetReleaseSavepointSql(string name)
63+
=> throw new NotSupportedException();
64+
}
65+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
using System;
2+
using System.Data.Common;
3+
using Microsoft.EntityFrameworkCore;
4+
using Microsoft.EntityFrameworkCore.Diagnostics;
5+
using Microsoft.EntityFrameworkCore.Storage;
6+
7+
namespace EntityFrameworkCore.Jet.Storage.Internal
8+
{
9+
public class JetTransactionFactory : IRelationalTransactionFactory
10+
{
11+
public virtual RelationalTransaction Create(
12+
IRelationalConnection connection,
13+
DbTransaction transaction,
14+
Guid transactionId,
15+
IDiagnosticsLogger<DbLoggerCategory.Database.Transaction> logger,
16+
bool transactionOwned)
17+
=> new JetTransaction(connection, transaction, transactionId, logger, transactionOwned);
18+
}
19+
}

0 commit comments

Comments
 (0)