Home > Enterprise >  voa_class related exception while browsing through objects in DB, using Telerik libraries
voa_class related exception while browsing through objects in DB, using Telerik libraries

Time:09-17

Edit2: this question started as a question on how to browse through tables, but it turned into a question about Telerik voa_class exception

Edit1: this question contains two ways of trying to do the same thing.

I would like to do something like:

var Obj1 = database.GetData<Class1>().First();
var Obj2 = database.GetData<Class1>().Next();

First attempt

The idea of Next() is simply to take another one. As Next() method does not exist, so I've decided to try this here:

var Obj1 = database.GetData<Class1>().First();
var Obj2 = database.GetData<Class1>().Single(o => o.Name != Obj1.Name);

This, however, generates a weird exception:

Telerik.OpenAccess.Exceptions.DataStoreException
  HResult=0x80131500
  Message=Row for OID GenericOID@87f2834a Class1 Id=2 NOTRES  is not in the hierarchy starting at <Namespace>.Class1 ('Class1s') (voa_class for row is ...)
  Source=Telerik.OpenAccess.Runtime
  StackTrace:
   at OpenAccessRuntime.ExceptionWrapper.Throw()
   at OpenAccessRuntime.storagemanager.logging.LoggingStorageManager.executeQueryAll(ApplicationContext context, ImmutableQueryDetails query, CompiledQuery compiledQuery, QueryParameters parameters, Int32 skip, Int32 take)
   at OpenAccessRuntime.DataObjects.UnsynchronizedPMProxy.getAllQueryResults(CompiledQuery cq, QueryParameters parameters, Int32 skip, Int32 take)
   at OpenAccessRuntime.DataObjects.ForwardQueryResult.Resolve()
   at OpenAccessRuntime.DataObjects.ForwardQueryResult.Initialize()
   at OpenAccessRuntime.DataObjects.ForwardQueryResult.get_Item(Int32 indexParam)
   at OpenAccessRuntime.ListEnumerator.setCurrent(Int32 _pos)
   at OpenAccessRuntime.ListEnumerator.Move(Int32 relative)
   at OpenAccessRuntime.ListEnumerator.MoveNext()
   at Telerik.OpenAccess.Query.TypedEnumerator`1.MoveNext()
   at Telerik.OpenAccess.Query.ExpressionExecution.PerformDatabaseQuerySingle[TResult,T](ChainedContext context, Expression expression, QueryableCategory before, Int32& found, Int32 elemAt, Boolean single, Boolean diffType)
   at Telerik.OpenAccess.Query.ExpressionExecution.PerformQuerySingle[T,TResult](ExpressionCutter cutter, MethodCallExpression mce, ChainedContext piece, QueryOptions options)
   at Telerik.OpenAccess.Query.Piece`1.ExecuteSingle[TResult](Expression expression)
   at Telerik.OpenAccess.Query.Piece`1.System.Linq.IQueryProvider.Execute[TResult](Expression expr)
   at System.Linq.Queryable.Single[TSource](IQueryable`1 source, Expression`1 predicate)
   at <CurrentClass>.<CurrentMethod>() in C:\...\<Source_Code>.cs:line 54
   at ...

Second attempt

(This second attempt is based on this other question.)

IQueryable<Class1> query = database.GetData<Class1>();
query.OrderBy(u => u.Id);
var Obj1 = query.First();

query = query.Skip(1);
var Obj2 = query.First(); <== this line gives me an exception.

As an exception I get a similar one than the first.

What is this about?

CodePudding user response:

Apparently the source code is correct, but there seem to be problems with the database:
The table, corresponding with Class1, contains a column voa_class. The content of that column should be <NameSpace_of_Class1>.Class1. In case there's something else, like <Whatever_NameSpace>.<AnotherClass> or <AnotherNameSpace>.Class1 (like in my case), the mentioned exception gets generated.

  • Related