Skip to content

Commit

Permalink
Add a check to ShouldUseSameServiceProvider even when the extension h…
Browse files Browse the repository at this point in the history
…as no options

Fixes #26109
  • Loading branch information
AndriySvyryd authored Sep 20, 2021
1 parent ccde2d5 commit 501c60a
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ public override int GetServiceProviderHashCode()
/// <param name="other"> The other extension. </param>
/// <returns> A value indicating whether all of the options that require a new service provider are the same. </returns>
public override bool ShouldUseSameServiceProvider(DbContextOptionsExtensionInfo other)
=> true;
=> other is RelationalExtensionInfo;

/// <summary>
/// A message fragment for logging typically containing information about
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public override int GetServiceProviderHashCode()
=> 0;

public override bool ShouldUseSameServiceProvider(DbContextOptionsExtensionInfo other)
=> true;
=> other is ExtensionInfo;

public override void PopulateDebugInfo(IDictionary<string, string> debugInfo)
=> debugInfo["SqlServer:" + nameof(SqlServerNetTopologySuiteDbContextOptionsBuilderExtensions.UseNetTopologySuite)] = "1";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,9 @@ public ExtensionInfo(IDbContextOptionsExtension extension)
public override bool IsDatabaseProvider
=> true;

public override bool ShouldUseSameServiceProvider(DbContextOptionsExtensionInfo other)
=> other is ExtensionInfo;

public override string LogFragment
{
get
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,9 @@ public ExtensionInfo(IDbContextOptionsExtension extension)
public override bool IsDatabaseProvider
=> true;

public override bool ShouldUseSameServiceProvider(DbContextOptionsExtensionInfo other)
=> other is ExtensionInfo;

public override string LogFragment
{
get
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public override int GetServiceProviderHashCode()
=> 0;

public override bool ShouldUseSameServiceProvider(DbContextOptionsExtensionInfo other)
=> true;
=> other is ExtensionInfo;

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

0 comments on commit 501c60a

Please sign in to comment.