Table per Type Inheritance

Table per Type Inheritance

Postby SchneiderM » Mon 06 May 2013 08:17

Hello,
we are having a problem with EF 5.0 and Table per Type inheritance on Oracle.
We have a parent entity and multiple (3) derived entities.
When we try to load a child entity with Find() we got this exception:
System.InvalidOperationException: The specified cast from a materialized 'EntityFramework.Child' type to the 'EntityFramework.Child2' type is not valid.
at System.Data.Common.Internal.Materialization.Translator.CheckedConvert[TSource,TTarget](TSource value)
at lambda_method(Closure , Shaper )
at System.Data.Common.Internal.Materialization.Shaper.HandleEntityAppendOnly[TEntity](Func`2 constructEntityDelegate, EntityKey entityKey, EntitySet entitySet)
at lambda_method(Closure , Shaper )
at System.Data.Common.Internal.Materialization.Coordinator`1.ReadNextElement(Shaper shaper)
at System.Data.Common.Internal.Materialization.Shaper`1.SimpleEnumerator.MoveNext()
at System.Linq.Enumerable.SingleOrDefault[TSource](IEnumerable`1 source)
at System.Data.Objects.ELinq.ObjectQueryProvider.<GetElementFunction>b__2[TResult](IEnumerable`1 sequence)
at System.Data.Objects.ELinq.ObjectQueryProvider.ExecuteSingle[TResult](IEnumerable`1 query, Expression queryRoot)
at System.Data.Objects.ELinq.ObjectQueryProvider.System.Linq.IQueryProvider.Execute[S](Expression expression)
at System.Linq.Queryable.SingleOrDefault[TSource](IQueryable`1 source)
at System.Data.Entity.Internal.Linq.InternalSet`1.FindInStore(WrappedEntityKey key, String keyValuesParamName)
at System.Data.Entity.Internal.Linq.InternalSet`1.Find(Object[] keyValues)
at System.Data.Entity.DbSet`1.Find(Object[] keyValues)
at EntityFramework.Program.Main() in ...\Program.cs:line 45


When we search the entity with First(), we aren't having any problems.
Any suggestions?

Thx
Markus
SchneiderM
 
Posts: 5
Joined: Wed 27 Feb 2013 20:00

Re: Table per Type Inheritance

Postby Shalex » Wed 15 May 2013 15:33

This is an Oracle Server problem: http://stackoverflow.com/questions/11366039/oracle-11g-release-1-vs-2-different-behavior-of-left-outer-join. Please try connecting to another version of Oracle Server.
Shalex
Devart Team
 
Posts: 7703
Joined: Thu 14 Aug 2008 12:44


Return to dotConnect for Oracle