Skip to content

Commit 13bc3d9

Browse files
committed
Apply corrections of decimal aggregate columns for postgre
+ small code imrovements of base DomainHandler
1 parent a5a6de4 commit 13bc3d9

File tree

2 files changed

+26
-21
lines changed

2 files changed

+26
-21
lines changed

Orm/Xtensive.Orm.PostgreSql/Orm.Providers.PostgreSql/DomainHandler.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
using System.Linq;
1010
using Xtensive.Core;
1111
using Xtensive.Orm.Rse.Compilation;
12+
using Xtensive.Orm.Rse.Transformation;
1213

1314
namespace Xtensive.Orm.Providers.PostgreSql
1415
{
@@ -21,6 +22,12 @@ public class DomainHandler : Providers.DomainHandler
2122
protected override ICompiler CreateCompiler(CompilerConfiguration configuration) =>
2223
new SqlCompiler(Handlers, configuration);
2324

25+
protected override IPreCompiler CreatePreCompiler(CompilerConfiguration configuration)
26+
{
27+
var decimalAggregateCorrector = new AggregateOverDecimalColumnCorrector(Handlers.Domain.Model);
28+
return new CompositePreCompiler(decimalAggregateCorrector, base.CreatePreCompiler(configuration));
29+
}
30+
2431
/// <inheritdoc/>
2532
protected override IEnumerable<Type> GetProviderCompilerContainers()
2633
{

Orm/Xtensive.Orm/Orm/Providers/DomainHandler.cs

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -168,31 +168,29 @@ private void BuildQueryPreprocessors()
168168
{
169169
var unordered = Domain.Services.GetAll<IQueryPreprocessor>();
170170
var ordered = unordered.SortTopologically((first, second) => second.IsDependentOn(first));
171-
if (ordered==null)
172-
throw new InvalidOperationException(Strings.ExCyclicDependencyInQueryPreprocessorGraphIsDetected);
173-
QueryPreprocessors = ordered;
171+
QueryPreprocessors = ordered ?? throw new InvalidOperationException(Strings.ExCyclicDependencyInQueryPreprocessorGraphIsDetected);
174172
}
175173

176174
private static ProviderOrderingDescriptor ResolveOrderingDescriptor(CompilableProvider provider)
177175
{
178-
bool isOrderSensitive = provider.Type==ProviderType.Skip
179-
|| provider.Type == ProviderType.Take
180-
|| provider.Type == ProviderType.Seek
181-
|| provider.Type == ProviderType.Paging
182-
|| provider.Type == ProviderType.RowNumber;
183-
bool preservesOrder = provider.Type==ProviderType.Take
184-
|| provider.Type == ProviderType.Skip
185-
|| provider.Type == ProviderType.Seek
186-
|| provider.Type == ProviderType.RowNumber
187-
|| provider.Type == ProviderType.Paging
188-
|| provider.Type == ProviderType.Distinct
189-
|| provider.Type == ProviderType.Alias;
190-
bool isOrderBreaker = provider.Type == ProviderType.Except
191-
|| provider.Type == ProviderType.Intersect
192-
|| provider.Type == ProviderType.Union
193-
|| provider.Type == ProviderType.Concat
194-
|| provider.Type == ProviderType.Existence;
195-
bool isSorter = provider.Type==ProviderType.Sort || provider.Type == ProviderType.Index;
176+
var isOrderSensitive = provider.Type is ProviderType.Skip
177+
or ProviderType.Take
178+
or ProviderType.Seek
179+
or ProviderType.Paging
180+
or ProviderType.RowNumber;
181+
var preservesOrder = provider.Type is ProviderType.Skip
182+
or ProviderType.Take
183+
or ProviderType.Seek
184+
or ProviderType.Paging
185+
or ProviderType.RowNumber
186+
or ProviderType.Distinct
187+
or ProviderType.Alias;
188+
var isOrderBreaker = provider.Type is ProviderType.Except
189+
or ProviderType.Intersect
190+
or ProviderType.Union
191+
or ProviderType.Concat
192+
or ProviderType.Existence;
193+
var isSorter = provider.Type is ProviderType.Sort or ProviderType.Index;
196194
return new ProviderOrderingDescriptor(isOrderSensitive, preservesOrder, isOrderBreaker, isSorter);
197195
}
198196

0 commit comments

Comments
 (0)