No AdoTypeConverter has been registered for the clrType.
Parameter name: clrType
Actual value was Microsoft.SqlServer.Types.SqlGeometry.
I assume that on a clean install with only SQL Server 2012, the preferred dll will reference version 11.0.0.0, as 10.0.0.0 may not be available without some kind of backwards compatability. Any thoughts on this?
6 Answers, 1 is accepted
Can you please try to generate a SqlGeometry type in your application before any Context is loaded? This would ensure that the respective dll is loaded and the TypeConverter can handle this type.
I hope this information is useful for you.
Feel free to ask if you have any other question.
Ralph
the Telerik team

Dim g
As
New
Microsoft.SqlServer.Types.SqlGeometry
Using x
As
New
EntitiesModel
Dim
p
As
IQueryable(Of WorkRequest) = _
From workrequest1
In
x.WorkRequests _
Join workrequestgeometry
In
x.WorkRequestGeometries _
On
workrequest1 Equals WorkRequestGeometry.WorkRequest _
Where WorkRequestGeometry.ShapeWeb.STIntersects(g).Equals(1) _
Take (3) _
Select
workrequest1
Dim
l
As
List(Of WorkRequest) = p.ToList
End
Using
When I reference Microsoft.SqlServer.Types.dll version 10.0.0.0 it works (no results returned because I did not initialize the geometry in this sample, but it works in production just fine).
When I reference Microsoft.SqlServer.Types.dll 11.0.0.0 it throws the exception above.
I tried to reproduce the behavior you described with the attached project but without success. I was using the latest internal build (2012.1.427.1) and referenced Microsoft.SqlServer.Types Version 11.
Have you also tried the latest internal build? If not, could you please try it? Is the attached sample application running in your environment (using the latest internal build)?
I am looking forward to hearing from you soon.
Ralph
the Telerik team

(VB.Net)
Using ctx As New EntitiesModel
Dim geo As New _SpatialTable
Dim polygon As String = "POLYGON((0 0,0 8,8 8,8 4,4 4,4 0,0 0))"
Dim sqlgeo As Microsoft.SqlServer.Types.SqlGeometry = Microsoft.SqlServer.Types.SqlGeometry.STGeomFromText(New System.Data.SqlTypes.SqlChars(polygon), 0)
geo.GeomCol1 = sqlgeo
ctx.Add(geo)
ctx.SaveChanges()
Dim geos As List(Of _SpatialTable) = ctx._SpatialTables.ToList()
Dim p As IQueryable(Of _SpatialTable) = _
From st In ctx._SpatialTables
Where st.GeomCol1.STIntersects(sqlgeo).Equals(1)
Dim geos2 As List(Of _SpatialTable) = p.ToList
End Using
Thank you again. No I am also able to see the reported exception. The problem only occurs if you pass parameters to queries that are of the version 11 type. There we are currently not able to get the appropriate TypeConverter. For queries without parameters, we are able to detect the correct type while providing the result, because we can use the column type to calculate the appropriate TypeConverter.
Unfortunately, the only workaround for you at the moment is, to hard link against the version 10 dll.
I have added this issue to our backlog to provide a solution for that in the future.
Again thank you for pointing this out.
Feel free to ask if you have any other question.
Ralph
the Telerik team
