Entity Framework Core 1.0 throws System.NullReferenceException by SaveChanges

Re: Entity Framework Core 1.0 throws System.NullReferenceException by SaveChanges

Postby seb1487 » Wed 07 Sep 2016 11:29

Hi Shalex,
it works now.

Thanks,
seb1487
seb1487
 
Posts: 18
Joined: Fri 24 Jun 2016 10:27

Re: Entity Framework Core 1.0 throws System.NullReferenceException by SaveChanges

Postby palmi » Fri 17 Feb 2017 02:33

Hi Support,

I still have the problem with version 9.2.200 and EF Core when executing following Where clause on a nullable foreign key:
.Where(o => SelectedSupplierIds.Contains(o.SupplierId));

Error:
Unexpected primitive type kind 'a'
palmi
 
Posts: 18
Joined: Thu 16 Feb 2017 16:52

Re: Entity Framework Core 1.0 throws System.NullReferenceException by SaveChanges

Postby Shalex » Mon 20 Feb 2017 19:37

palmi wrote:Hi Support,

I still have the problem with version 9.2.200 and EF Core when executing following Where clause on a nullable foreign key:
.Where(o => SelectedSupplierIds.Contains(o.SupplierId));

Error:
Unexpected primitive type kind 'a'
Thank you for your report. We have reproduced the issue. We will notify you when the problem is fixed.
Shalex
Devart Team
 
Posts: 7600
Joined: Thu 14 Aug 2008 12:44

Re: Entity Framework Core 1.0 throws System.NullReferenceException by SaveChanges

Postby Shalex » Wed 22 Feb 2017 11:45

palmi wrote:Hi Support,

I still have the problem with version 9.2.200 and EF Core when executing following Where clause on a nullable foreign key:
.Where(o => SelectedSupplierIds.Contains(o.SupplierId));

Error:
Unexpected primitive type kind 'a'
The translation of collection's Contains method in LINQ query to SQL statement in EF Core is supported. We will notify you when the corresponding build of dotConnect for Oracle is available for download.
Shalex
Devart Team
 
Posts: 7600
Joined: Thu 14 Aug 2008 12:44

Re: Entity Framework Core 1.0 throws System.NullReferenceException by SaveChanges

Postby Shalex » Fri 03 Mar 2017 09:45

New build of dotConnect for Oracle 9.2.220 is available for download now: http://forums.devart.com/viewtopic.php?f=1&t=35058.
Shalex
Devart Team
 
Posts: 7600
Joined: Thu 14 Aug 2008 12:44

Re: Entity Framework Core 1.0 throws System.NullReferenceException by SaveChanges

Postby palmi » Fri 03 Mar 2017 19:21

Hi Support,
Thanks. Now I don't get an Exception but it does not really work.
When I have a List<long> it translates following LINQ query
Code: Select all
.Where(o => SelectedSupplierIds.Contains(o.SupplierId));

to following SQL statement
Code: Select all
SELECT ... WHERE ... "order"."SupplierId" IN (2)


I looks like it is always
Code: Select all
IN (2)
no matter how many entries my list has or what the value is.
palmi
 
Posts: 18
Joined: Thu 16 Feb 2017 16:52

Re: Entity Framework Core 1.0 throws System.NullReferenceException by SaveChanges

Postby Shalex » Mon 06 Mar 2017 15:09

1. Please set a break point, run your application in the debug mode, navigate to Debug > Windows > Modules, and make sure that the only Devart.* assemblies loaded in the process are:
Devart.Data.dll v5.0.1644.0
Devart.Data.Oracle.dll v9.2.220.0
Devart.Data.Oracle.Entity.EFCore.dll v9.2.220.0

2. We can reproduce the issue with ignoring some List values in this scenario:
Code: Select all
    var Ids = new List<int>() { 1, 2};
    var query = dbContext.Class1.Where(o => Ids.Contains(o.Id));
    var results1 = query.ToList();
    Ids.Add(3);
    Ids.Add(4);
    var results2 = query.ToList();

The generated SQL in both cases is the same:
Code: Select all
SELECT "o"."Id", "o"."Class2Id", "o"."Name"
FROM "Class1" "o"
WHERE "o"."Id" IN (1, 2)

That is a designed behaviour (System.Data.SqlClient will work in the same way), the SQL query was cached by EF Core with the first query.ToList() and used with the second query.ToList().
Shalex
Devart Team
 
Posts: 7600
Joined: Thu 14 Aug 2008 12:44

Re: Entity Framework Core 1.0 throws System.NullReferenceException by SaveChanges

Postby palmi » Sun 02 Apr 2017 21:17

Hi Support,

I have this issue now again with EF Core 1.1 and Version 9.2.220.

When I have a List<long> it translates following LINQ query
Code: Select all
.Where(s => s.CatalogItems.Any(ci => searchParams.SelectedSupplierIds.Contains(ci.Catalog.SupplierId)));


to following SQL statement
Code: Select all
SELECT ... WHERE "ci.Catalog"."SupplierId" IN (1, 2, 3, 4, 5, 6, 7, 8, 9, 10)


And it is always
Code: Select all
IN (1, 2, 3, ...)

even though the List<long> (SelectedSupplierIds) only contains one item (e.g. 7)
palmi
 
Posts: 18
Joined: Thu 16 Feb 2017 16:52

Re: Entity Framework Core 1.0 throws System.NullReferenceException by SaveChanges

Postby Shalex » Fri 07 Apr 2017 12:32

We cannot reproduce the issue in our environment. Could you please send us a small test project for reproducing?
Shalex
Devart Team
 
Posts: 7600
Joined: Thu 14 Aug 2008 12:44

Previous

Return to dotConnect for Oracle