"Entity type has no key" error with views (v6.30.165.0)

Discussion of open issues, suggestions and bugs regarding LinqConnect – Devart's LINQ to SQL compatible ORM
Post Reply
edwin
Posts: 19
Joined: Thu 08 Oct 2009 09:15

"Entity type has no key" error with views (v6.30.165.0)

Post by edwin » Mon 06 Jun 2011 15:28

We have the following error using the latest DevArt dotConnect for Oracle:

Code: Select all

System.InvalidOperationException: Entity type has no key. 
   at Devart.Data.Linq.Mapping.l.a(IList`1 A_0) 
   at Devart.Data.Linq.Mapping.l.a(MetaType A_0) 
   at Devart.Data.Linq.t.c(MetaType A_0) 
   at Devart.Data.Linq.Provider.DataProvider.TryGetQueryObjectByKey(Expression query, Object& queryObjectKey) 
   at Devart.Data.Linq.Provider.DataProvider.BuildQuery(Expression query) 
   at Devart.Data.Linq.Provider.DataProvider.Devart.Data.Linq.Provider.IProvider.Compile(Expression query) 
   at Devart.Data.Linq.DataQuery`1.i() 
   at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection) 
   at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source) 
   at Jumbo.Juist.Controllers.BeheerController.ExecuteMedeaExport(AppDataContext context) 
This occurs in the following code:

Code: Select all

List list = context.V_MedeaExports.Where(x => x.Datum >= DateUtility.GetToday()).ToList(); 
V_MedeaExports is a view. We have other places were we use views, which do work and some don't. At the places where it doesn't work, an inequality (>=) is used, instead of all equalities (=) in the Where.

As an ugly workaround, I set Entity Key to 'true' for "Datum" (which means Date) in the linq2sql properties, but I don't know if this has other undesired consequences...

edwin
Posts: 19
Joined: Thu 08 Oct 2009 09:15

Post by edwin » Tue 07 Jun 2011 09:27

As a correction to my last post, the workaround is not working!!!

Although no exception is thrown, not all data is present!

StanislavK
Devart Team
Posts: 1710
Joined: Thu 03 Dec 2009 10:48

Post by StanislavK » Tue 07 Jun 2011 15:37

Thank you for the report, we have reproduced the problem. We will analyze it and inform you about the results as soon as possible.

StanislavK
Devart Team
Posts: 1710
Joined: Thu 03 Dec 2009 10:48

Post by StanislavK » Wed 08 Jun 2011 16:52

We have fixed this problem, the fix will be available in the nearest build. We will post here when this build is released.

StanislavK
Devart Team
Posts: 1710
Joined: Thu 03 Dec 2009 10:48

Post by StanislavK » Fri 17 Jun 2011 16:27

We have released the new 6.30.172 build of dotConnect for Oracle, which includes the fix for the problem with querying views (the fix is available in the new 2.50.25 build of LinqConnect as well). The new build can be downloaded from
http://www.devart.com/dotconnect/oracle/download.html
(the trial version) or from Registered Users' Area (for users with active subscription only):
http://secure.devart.com/

For the information about other fixes and improvements available in dotConnect for Oracle 6.30.172, please refer to
http://www.devart.com/forums/viewtopic.php?t=21277

Post Reply