diff --git a/src/EFCore.PG/Extensions/NpgsqlServiceCollectionExtensions.cs b/src/EFCore.PG/Extensions/NpgsqlServiceCollectionExtensions.cs index a726dec9f..55761b14d 100644 --- a/src/EFCore.PG/Extensions/NpgsqlServiceCollectionExtensions.cs +++ b/src/EFCore.PG/Extensions/NpgsqlServiceCollectionExtensions.cs @@ -86,6 +86,7 @@ public static IServiceCollection AddEntityFrameworkNpgsql([NotNull] this IServic .TryAdd() .TryAdd(p => p.GetService()) .TryAdd() + .TryAdd() .TryAddProviderSpecificServices( b => b .TryAddSingleton() diff --git a/src/EFCore.PG/Query/Internal/NpgsqlQueryCompilationContext.cs b/src/EFCore.PG/Query/Internal/NpgsqlQueryCompilationContext.cs new file mode 100644 index 000000000..29b9e82ee --- /dev/null +++ b/src/EFCore.PG/Query/Internal/NpgsqlQueryCompilationContext.cs @@ -0,0 +1,17 @@ +using JetBrains.Annotations; +using Microsoft.EntityFrameworkCore.Query; + +namespace Npgsql.EntityFrameworkCore.PostgreSQL.Query.Internal +{ + public class NpgsqlQueryCompilationContext : RelationalQueryCompilationContext + { + public NpgsqlQueryCompilationContext( + [NotNull] QueryCompilationContextDependencies dependencies, + [NotNull] RelationalQueryCompilationContextDependencies relationalDependencies, bool async) + : base(dependencies, relationalDependencies, async) + { + } + + public override bool IsBuffering => base.IsBuffering || IsSplitQuery; + } +} diff --git a/src/EFCore.PG/Query/Internal/NpgsqlQueryCompilationContextFactory.cs b/src/EFCore.PG/Query/Internal/NpgsqlQueryCompilationContextFactory.cs new file mode 100644 index 000000000..4ab9aeb72 --- /dev/null +++ b/src/EFCore.PG/Query/Internal/NpgsqlQueryCompilationContextFactory.cs @@ -0,0 +1,26 @@ +using JetBrains.Annotations; +using Microsoft.EntityFrameworkCore.Query; +using Npgsql.EntityFrameworkCore.PostgreSQL.Utilities; + +namespace Npgsql.EntityFrameworkCore.PostgreSQL.Query.Internal +{ + public class NpgsqlQueryCompilationContextFactory : IQueryCompilationContextFactory + { + readonly QueryCompilationContextDependencies _dependencies; + readonly RelationalQueryCompilationContextDependencies _relationalDependencies; + + public NpgsqlQueryCompilationContextFactory( + [NotNull] QueryCompilationContextDependencies dependencies, + [NotNull] RelationalQueryCompilationContextDependencies relationalDependencies) + { + Check.NotNull(dependencies, nameof(dependencies)); + Check.NotNull(relationalDependencies, nameof(relationalDependencies)); + + _dependencies = dependencies; + _relationalDependencies = relationalDependencies; + } + + public virtual QueryCompilationContext Create(bool async) + => new NpgsqlQueryCompilationContext(_dependencies, _relationalDependencies, async); + } +}