Skip to content

Commit

Permalink
fix interceptors build against efcore7
Browse files Browse the repository at this point in the history
  • Loading branch information
MaceWindu committed Nov 12, 2022
1 parent df56f7f commit 7393c62
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,12 @@ public override string LogFragment
}
}

public override long GetServiceProviderHashCode()
{
return 0;
}
public override int GetServiceProviderHashCode() => 0;

public override void PopulateDebugInfo(IDictionary<string, string> debugInfo)
=> debugInfo["Linq2Db"] = "1";

public override bool ShouldUseSameServiceProvider(DbContextOptionsExtensionInfo other) => true;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace LinqToDB.EntityFrameworkCore
/// </summary>
public class LinqToDBContextOptionsBuilder
{
private readonly LinqToDBOptionsExtension _extension;
private readonly LinqToDBOptionsExtension? _extension;

/// <summary>
/// Db context options
Expand All @@ -34,7 +34,7 @@ public LinqToDBContextOptionsBuilder(DbContextOptionsBuilder optionsBuilder)
/// <returns></returns>
public LinqToDBContextOptionsBuilder AddInterceptor(IInterceptor interceptor)
{
_extension.Interceptors.Add(interceptor);
_extension?.Interceptors.Add(interceptor);
return this;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,13 +147,13 @@ public ValueTask<InterceptionResult<DbDataReader>> ReaderExecutingAsync(DbComman
return ValueTask.FromResult(result);
}

public object ScalarExecuted(DbCommand command, CommandExecutedEventData eventData, object result)
public object? ScalarExecuted(DbCommand command, CommandExecutedEventData eventData, object? result)
{
HasInterceptorBeenInvoked = true;
return result;
}

public ValueTask<object> ScalarExecutedAsync(DbCommand command, CommandExecutedEventData eventData, object result, CancellationToken cancellationToken = default)
public ValueTask<object?> ScalarExecutedAsync(DbCommand command, CommandExecutedEventData eventData, object? result, CancellationToken cancellationToken = default)
{
HasInterceptorBeenInvoked = true;
return ValueTask.FromResult(result);
Expand Down

0 comments on commit 7393c62

Please sign in to comment.