Problems with caching DbGeography DB type

May 29 at 1:17 PM
Hello,

Do you know if DBGeography DB type is supported?

I have some issues retrieving property mapped to that data type and want to be sure if I have done something wrong or not.

Cheers,
Lyubomir
Coordinator
Jun 2 at 5:21 AM
Hi Lyubomir,

Do spatial types work without the cache in your app? There isn't anything I can think of that would block spatial types but if they work without caching then it feels like a bug in which case you need to create a new work item and include a simplified repro and I will take a look.

Thanks,
Pawel
Jun 4 at 8:55 PM
Edited Jun 4 at 8:56 PM
Hi Pawel,

Just to give you more information regarding the error which I am getting:

{"Spatial readers can only be produced from readers of type SqlDataReader. A reader of type EFCache.CachingReader was provided."}

Please check the screenshot http://screencast.com/t/PrsBZtQMDV

This is from MVCForum http://www.mvcforum.com

They are using your caching mechanism, but I added a spatial field in one of the entities there and stopped working.

Kind Regards,
Lyubomir
Coordinator
Jun 5 at 4:26 AM
Hi Lyubomir,

Thanks for posting the details. They are very helpful. I looked briefly at the code and I kind of understand what's going on but am still not sure if this is a bug in the EF Cache or the SqlServer provider (or in both places). SqlServer provider expects SqlDataReader but since the results were cached we no longer have SqlDataReader but a DbReader class derived instance. If I can successfully override the GetSpatialReader method in database agnostic way to return a custom SpatialDbDataReader created from the cached results then the bug is only in EFCache since it does not handle this case correctly. If I cannot then there is a bigger issue that might need to be fixed in EF. I am pretty busy right now but will try to take a look at this in a couple of weeks. I will create a work item to track this issue.

Thanks,
Pawel
Coordinator
Aug 21 at 4:06 AM
To close the loop - there is a design flaw in EF due to which it’s impossible to use spatial types with a wrapping provider if result buffering is turned on. For more details take a look at this bug: https://efcache.codeplex.com/workitem/6