System.InvalidCastException while running a query

Sep 7, 2008 at 6:51 PM

When I run the FindAll method of a class which is derived from DbObjectModel I'm getting a System.InvalidCastException. Writing Data works fine. What's the cause and how can I debug it?

Because you're building the objects with replection I can't see the cause in the callstack :(

Sep 8, 2008 at 2:32 AM
There are 2 places to using Emit(not reflection).
One for retrive items.
One for dynamic object.

You can just add ObjectHandlerType as "Reflection" in web.config.(just like it in UnitTest.config.xml of Lephone.UnitTest)
This will help you to debug retrive item functions.
For your problem maybe it's enough.

And you can modify MemoryAssembly.cs to make it generate dll to disk if you know well about Emit.
This will help you to debug dynamic object.

If you still have problem please put your code here and I can see if it an issue about DbEntry.

Sep 8, 2008 at 9:05 AM
Edited Sep 8, 2008 at 9:07 AM

changing the ObjectHandlerType to Reflection helped me to find the cause. I've used a wrong datatype in my class definition.