EF Core Linq Include method not working

EF Core Linq Include method not working

Postby yelenamaks » Sat 04 Nov 2017 15:07

I recently updated to asp.net core 2.0. Since upgrading all my Linq queries using Include Method are failing, it is not translated properly to SQL.

For instance this:

Code: Select all
    var entities = helpTopicRepository.Entities.Include(x => x.HelpArticles).FirstOrDefault(t => topicIds.Any(a => a == t.Id));


is translated to:

Code: Select all
    SELECT x.HelpArticles.ART_ID,
    x.HelpArticles.AVAILABLE,
    x.HelpArticles.CONTENT,
    x.HelpArticles.DISPLAYORDER,
    x.HelpArticles.HELPFULNO,
    x.HelpArticles.HELPFULYES,
    x.HelpArticles.KEYWORDS,
    x.HelpArticles.TITLE,
    x.HelpArticles.TOPICID
    FROM HELPARTICLE x.HelpArticles


which is results in the following error:

> Devart.Data.Oracle.OracleException (0x80004005): ORA-00933: SQL
> command not properly ended at Devart.Data.Oracle.ay.b() at
> Devart.Data.Oracle.am.f() at Devart.Data.Oracle.am.e() at
> Devart.Data.Oracle.c5.a(am A_0, Int32 A_1) at
> Devart.Data.Oracle.c5.a(Int32 A_0, bg A_1) at
> Devart.Data.Oracle.OracleCommand.InternalExecute(CommandBehavior
> behavior, IDisposable disposable, Int32 startRecord, Int32 maxRecords,
> Boolean nonQuery) at
> Devart.Common.DbCommandBase.ExecuteDbDataReader(CommandBehavior
> behavior, Boolean nonQuery) at
> Devart.Data.Oracle.Entity.ai.a(CommandBehavior A_0) at
> Devart.Common.Entity.cj.d(CommandBehavior A_0) at
> Devart.Data.Oracle.Entity.ai.b(CommandBehavior A_0) at
> System.Data.Common.DbCommand.ExecuteReader() at
> Microsoft.EntityFrameworkCore.Storage.Internal.RelationalCommand.Execute(IRelationalConnection
> connection, DbCommandMethod executeMethod, IReadOnlyDictionary`2
> parameterValues) at
> Microsoft.EntityFrameworkCore.Storage.Internal.RelationalCommand.ExecuteReader(IRelationalConnection
> connection, IReadOnlyDictionary`2 parameterValues) at
> Microsoft.EntityFrameworkCore.Query.Internal.QueryingEnumerable`1.Enumerator.BufferlessMoveNext(Boolean
> buffer) at
> Microsoft.EntityFrameworkCore.Query.Internal.QueryingEnumerable`1.Enumerator.MoveNext()
> at
> Microsoft.EntityFrameworkCore.Query.Internal.QueryBuffer.IncludeCollection(Int32
> includeId, INavigation navigation, INavigation inverseNavigation,
> IEntityType targetEntityType, IClrCollectionAccessor
> clrCollectionAccessor, IClrPropertySetter inverseClrPropertySetter,
> Boolean tracking, Object entity, Func`1 relatedEntitiesFactory) at
> lambda_method(Closure , QueryContext , Client , Object[] ) at
> Microsoft.EntityFrameworkCore.Query.Internal.IncludeCompiler._Include[TEntity](QueryContext
> queryContext, TEntity entity, Object[] included, Action`3 fixup) at
> lambda_method(Closure , Client ) at
> System.Linq.Enumerable.SelectEnumerableIterator`2.MoveNext() at
> System.Linq.Enumerable.SingleOrDefault[TSource](IEnumerable`1 source)
> at lambda_method(Closure , QueryContext ) at
> Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.<>c__DisplayClass17_0`1.<CompileQueryCore>b__0(QueryContext
> qc) ORA-00933: SQL command not properly ended
yelenamaks
 
Posts: 1
Joined: Sat 04 Nov 2017 14:55

Re: EF Core Linq Include method not working

Postby Shalex » Tue 07 Nov 2017 15:00

We cannot reproduce the issue at the moment. Please upload a small complete test project with the corresponding DDL/DML script to ftp://ftp.devart.com (credentials: anonymous / yourEmail). Also specify the version of your Oracle Server.
Shalex
Devart Team
 
Posts: 7777
Joined: Thu 14 Aug 2008 12:44

Re: EF Core Linq Include method not working

Postby Shalex » Fri 10 Nov 2017 16:13

The bug with using multiple .Include() in EF Core 2 is fixed. Look forward to the next public build of dotConnect for Oracle.
Shalex
Devart Team
 
Posts: 7777
Joined: Thu 14 Aug 2008 12:44


Return to dotConnect for Oracle