Inheritance problems

Inheritance problems

Postby Alladin » Sat 10 Apr 2010 01:16

Hi there,

I have three classes derived from each other (Subject->Person->PrivatePerson). The root Subject class is abstract, the other classes have discriminator inheritance codes set to 1(Person) and 2 (PrivatePerson). The discriminator column is of type integer (NUMBER(10) is database).

First problem:

When I try to read data from Subject entity like this:

Code: Select all
var subjects = ctx.Subjects.ToList();


I get the following exception:

The binary operator Equal is not defined for the types 'System.Int32' and 'System.Object'.


Very meaningful obfuscated callstack:

at System.Linq.Expressions.Expression.GetEqualityComparisonOperator(ExpressionType binaryType, String opName, Expression left, Expression right, Boolean liftToNull)
at System.Linq.Expressions.Expression.Equal(Expression left, Expression right)
at Devart.Data.Linq.Provider.SelectionBuilder.a(bk A_0)
at Devart.Data.Linq.Provider.SelectionBuilder.a(SqlExpression A_0)
at Devart.Data.Linq.Provider.SelectionBuilder.BuildSelection(SqlExpression selection)
at Devart.Data.Linq.Provider.j.a(n A_0, SqlExpression A_1)
at Devart.Data.Linq.Provider.j.a(Type A_0, SqlExpression A_1, n A_2, Type A_3, Type A_4)
at Devart.Data.Linq.Provider.DataProvider.b.a(List`1 A_0, n A_1, SqlNode A_2)
at Devart.Data.Linq.Provider.DataProvider.b..ctor(a A_0, n A_1)
at Devart.Data.Linq.Provider.DataProvider.a(Expression A_0)
at Devart.Data.Linq.Provider.DataProvider.i(Expression A_0)
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 Nitro.Dal.Program.Main(String[] args) in d:\tests\DevartProbe\DevartProbe\Program.cs:line 51


Second problem:

I want to select only Persons instances.

Variant A)
Code: Select all
var persons = ctx.Persons.ToList();

Doesn't compile, because no Persons table property generated in data context.

Variant B)
Code: Select all
var persons = ctx.GetTable().ToList();


Crash with exception:

Could not retrieve a Table for inheritance subtype 'Person', try Table of Subject instead.


Variant C)
Code: Select all
var persons = ctx.Subjects.OfType().ToList();


Crash with exception from the very first problem.

Any help?
Alladin
 
Posts: 149
Joined: Mon 27 Nov 2006 16:18

Postby AndreyR » Tue 13 Apr 2010 11:00

Could you please send me (support * devart* com, subject "LINQ Inheritance") both the model and the script of the underlying tables?
This will speed up our investigation.
AndreyR
Devart Team
 
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Postby Alladin » Tue 13 Apr 2010 16:19

project has been sent
Alladin
 
Posts: 149
Joined: Mon 27 Nov 2006 16:18

Postby AndreyR » Thu 15 Apr 2010 12:16

Thank you for the project, we have reproduced the problem.
I will post here about the results of our investigation.
AndreyR
Devart Team
 
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Postby AndreyR » Mon 31 May 2010 15:40

The problem is fixed in the latest 5.70.140 build of dotConnect for Oracle.
Please let me know if the problem persists.
AndreyR
Devart Team
 
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Postby AndreyR » Mon 31 May 2010 15:40

The problem is fixed in the latest 5.70.140 build of dotConnect for Oracle.
Please let me know if the problem persists.
AndreyR
Devart Team
 
Posts: 2919
Joined: Mon 07 Jul 2008 13:16


Return to dotConnect for Oracle