Skip to content
This repository was archived by the owner on Feb 1, 2025. It is now read-only.

Commit 7393c62

Browse files
committed
fix interceptors build against efcore7
1 parent df56f7f commit 7393c62

File tree

3 files changed

+7
-8
lines changed

3 files changed

+7
-8
lines changed

Source/LinqToDB.EntityFrameworkCore/Internal/LinqToDBOptionsExtension.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,13 +100,12 @@ public override string LogFragment
100100
}
101101
}
102102

103-
public override long GetServiceProviderHashCode()
104-
{
105-
return 0;
106-
}
103+
public override int GetServiceProviderHashCode() => 0;
107104

108105
public override void PopulateDebugInfo(IDictionary<string, string> debugInfo)
109106
=> debugInfo["Linq2Db"] = "1";
107+
108+
public override bool ShouldUseSameServiceProvider(DbContextOptionsExtensionInfo other) => true;
110109
}
111110
}
112111
}

Source/LinqToDB.EntityFrameworkCore/LinqToDBContextOptionsBuilder.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ namespace LinqToDB.EntityFrameworkCore
1010
/// </summary>
1111
public class LinqToDBContextOptionsBuilder
1212
{
13-
private readonly LinqToDBOptionsExtension _extension;
13+
private readonly LinqToDBOptionsExtension? _extension;
1414

1515
/// <summary>
1616
/// Db context options
@@ -34,7 +34,7 @@ public LinqToDBContextOptionsBuilder(DbContextOptionsBuilder optionsBuilder)
3434
/// <returns></returns>
3535
public LinqToDBContextOptionsBuilder AddInterceptor(IInterceptor interceptor)
3636
{
37-
_extension.Interceptors.Add(interceptor);
37+
_extension?.Interceptors.Add(interceptor);
3838
return this;
3939
}
4040
}

Tests/LinqToDB.EntityFrameworkCore.BaseTests/Interceptors/TestEfCoreAndLinq2DbComboInterceptor.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,13 +147,13 @@ public ValueTask<InterceptionResult<DbDataReader>> ReaderExecutingAsync(DbComman
147147
return ValueTask.FromResult(result);
148148
}
149149

150-
public object ScalarExecuted(DbCommand command, CommandExecutedEventData eventData, object result)
150+
public object? ScalarExecuted(DbCommand command, CommandExecutedEventData eventData, object? result)
151151
{
152152
HasInterceptorBeenInvoked = true;
153153
return result;
154154
}
155155

156-
public ValueTask<object> ScalarExecutedAsync(DbCommand command, CommandExecutedEventData eventData, object result, CancellationToken cancellationToken = default)
156+
public ValueTask<object?> ScalarExecutedAsync(DbCommand command, CommandExecutedEventData eventData, object? result, CancellationToken cancellationToken = default)
157157
{
158158
HasInterceptorBeenInvoked = true;
159159
return ValueTask.FromResult(result);

0 commit comments

Comments
 (0)