This is a migrated thread and some comments may be shown as answers.

SQL Server 2012 - Microsoft.SqlServer.Types 11.0.0.0

6 Answers 138 Views
Databases and Data Types
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Chuck
Top achievements
Rank 1
Chuck asked on 19 May 2012, 09:40 PM
I am using the current version of the ORM (2012.1.301.2).  In my project I reference the Microsoft.SqlServer.Types.dll.  Everything still works as expected on my machine which has both SQL Server 2012 & SQL Server 2008 installed when I use the old version of the dll (10.0.0.0) referencing a SQL Server 2012 database.  But when I switch to the new version (Microsoft.SqlServer.Types.dll v. 11.0.0.0) I get the following error from the ORM:

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

Sort by
0
Ralph Waldenmaier
Telerik team
answered on 23 May 2012, 07:34 AM
Hi Chuck,

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.

Greetings,
Ralph
the Telerik team
Follow @OpenAccessORM Twitter channel to be the first one to get the latest updates on new releases, tips and tricks and sneak peeks at our product labs!
0
Chuck
Top achievements
Rank 1
answered on 23 May 2012, 07:50 PM
I am declaring the type prior to loading the Context, unless I totally don't understand what you mean.  I created a simple sample project to duplicate the issue.  I have replicated this in both VS2008 (using .Net 2.0) and VS2010 (using .Net 4.0).  Here is sample code that causes the issue:
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.
0
Ralph Waldenmaier
Telerik team
answered on 25 May 2012, 11:31 AM
Hello Chuck,

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.

All the best,
Ralph
the Telerik team
Follow @OpenAccessORM Twitter channel to be the first one to get the latest updates on new releases, tips and tricks and sneak peeks at our product labs!
0
Chuck
Top achievements
Rank 1
answered on 25 May 2012, 01:54 PM
Thank you for looking at this in depth.  I think you were unable to reproduce the behavior because you stopped short of running the actual spatial query.  The code you provided works on my system without installing the internal build, but please follow it with the following query:

(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()
 
            'The following 2 lines of codes contain the issue
    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
0
Accepted
Ralph Waldenmaier
Telerik team
answered on 25 May 2012, 03:14 PM
Hello Chuck,

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.

Greetings,
Ralph
the Telerik team
Follow @OpenAccessORM Twitter channel to be the first one to get the latest updates on new releases, tips and tricks and sneak peeks at our product labs!
0
Chuck
Top achievements
Rank 1
answered on 25 May 2012, 03:18 PM
Thank you.  I know you guys will get it working!
Tags
Databases and Data Types
Asked by
Chuck
Top achievements
Rank 1
Answers by
Ralph Waldenmaier
Telerik team
Chuck
Top achievements
Rank 1
Share this question
or