Skip to content

Commit 9cadc9a

Browse files
committed
Explicit FbQueryCompilationContext (to handle aliasses length (DNET-877)).
1 parent f8e68d5 commit 9cadc9a

File tree

3 files changed

+75
-0
lines changed

3 files changed

+75
-0
lines changed

Provider/src/FirebirdSql.EntityFrameworkCore.Firebird/Extensions/FbServiceCollectionExtensions.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
using Microsoft.EntityFrameworkCore.Infrastructure;
2929
using Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal;
3030
using Microsoft.EntityFrameworkCore.Migrations;
31+
using Microsoft.EntityFrameworkCore.Query;
3132
using Microsoft.EntityFrameworkCore.Query.ExpressionTranslators;
3233
using Microsoft.EntityFrameworkCore.Query.Sql;
3334
using Microsoft.EntityFrameworkCore.Storage;
@@ -52,6 +53,7 @@ public static IServiceCollection AddEntityFrameworkFirebird(this IServiceCollect
5253
.TryAdd<IRelationalConnection>(p => p.GetService<IFbRelationalConnection>())
5354
.TryAdd<IMigrationsSqlGenerator, FbMigrationsSqlGenerator>()
5455
.TryAdd<IHistoryRepository, FbHistoryRepository>()
56+
.TryAdd<IQueryCompilationContextFactory, FbQueryCompilationContextFactory>()
5557
.TryAdd<IMemberTranslator, FbCompositeMemberTranslator>()
5658
.TryAdd<ICompositeMethodCallTranslator, FbCompositeMethodCallTranslator>()
5759
.TryAdd<IQuerySqlGeneratorFactory, FbQuerySqlGeneratorFactory>()
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/*
2+
* The contents of this file are subject to the Initial
3+
* Developer's Public License Version 1.0 (the "License");
4+
* you may not use this file except in compliance with the
5+
* License. You may obtain a copy of the License at
6+
* https://github.com/FirebirdSQL/NETProvider/blob/master/license.txt.
7+
*
8+
* Software distributed under the License is distributed on
9+
* an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either
10+
* express or implied. See the License for the specific
11+
* language governing rights and limitations under the License.
12+
*
13+
* All Rights Reserved.
14+
*/
15+
16+
//$Authors = Jiri Cincura ([email protected])
17+
18+
using Microsoft.EntityFrameworkCore.Query;
19+
using Microsoft.EntityFrameworkCore.Query.Internal;
20+
21+
namespace FirebirdSql.EntityFrameworkCore.Firebird.Query.Sql.Internal
22+
{
23+
class FbQueryCompilationContext : RelationalQueryCompilationContext
24+
{
25+
public FbQueryCompilationContext(QueryCompilationContextDependencies dependencies, ILinqOperatorProvider linqOperatorProvider, IQueryMethodProvider queryMethodProvider, bool trackQueryResults)
26+
: base(dependencies, linqOperatorProvider, queryMethodProvider, trackQueryResults)
27+
{ }
28+
29+
public override int MaxTableAliasLength => 31;
30+
}
31+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/*
2+
* The contents of this file are subject to the Initial
3+
* Developer's Public License Version 1.0 (the "License");
4+
* you may not use this file except in compliance with the
5+
* License. You may obtain a copy of the License at
6+
* https://github.com/FirebirdSQL/NETProvider/blob/master/license.txt.
7+
*
8+
* Software distributed under the License is distributed on
9+
* an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either
10+
* express or implied. See the License for the specific
11+
* language governing rights and limitations under the License.
12+
*
13+
* All Rights Reserved.
14+
*/
15+
16+
//$Authors = Jiri Cincura ([email protected])
17+
18+
using Microsoft.EntityFrameworkCore.Query;
19+
using Microsoft.EntityFrameworkCore.Query.Internal;
20+
21+
namespace FirebirdSql.EntityFrameworkCore.Firebird.Query.Sql.Internal
22+
{
23+
public class FbQueryCompilationContextFactory : RelationalQueryCompilationContextFactory
24+
{
25+
public FbQueryCompilationContextFactory(QueryCompilationContextDependencies dependencies, RelationalQueryCompilationContextDependencies relationalDependencies)
26+
: base(dependencies, relationalDependencies)
27+
{ }
28+
29+
public override QueryCompilationContext Create(bool async)
30+
=> async
31+
? new FbQueryCompilationContext(
32+
Dependencies,
33+
new AsyncLinqOperatorProvider(),
34+
new AsyncQueryMethodProvider(),
35+
TrackQueryResults)
36+
: new FbQueryCompilationContext(
37+
Dependencies,
38+
new LinqOperatorProvider(),
39+
new QueryMethodProvider(),
40+
TrackQueryResults);
41+
}
42+
}

0 commit comments

Comments
 (0)