Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

LINQ to SQL Designer and the Geography datatype

I am having a few problems loading a table into the designer. I get the following error.

One or more selected items contain a data type that is not supported by the designer

Would I be correct in assuming it is the geography type used in the table that is causing this error?

Any pointers much appreciated.

like image 739
Chin Avatar asked Aug 27 '10 06:08

Chin


People also ask

Is geography a data type in SQL?

The geography spatial data type, geography, is implemented as a . NET common language runtime (CLR) data type in SQL Server. This type represents data in a round-earth coordinate system. The SQL Server geography data type stores ellipsoidal (round-earth) data, such as GPS latitude and longitude coordinates.

What is difference between geography and geometry in SQL Server?

SQL Server supports two spatial data types: the geometry data type and the geography data type. The geometry type represents data in a Euclidean (flat) coordinate system. The geography type represents data in a round-earth coordinate system.

What is Linq to SQL tools?

LINQ to SQL was the first object-relational mapping technology released by Microsoft. It works well in basic scenarios and continues to be supported in Visual Studio, but it's no longer under active development.


2 Answers

To correct this error:

  1. Create a view that is based on the desired table and that does not include the unsupported data type. 2.Drag the view from Server Explorer/Database Explorer onto the designer.

or see this article The Missing Linq to SQL Spatial,This article provides hints and hacks on how to use the SQL Server spatial data types -Geography and Geometry- in Linq to SQL

like image 60
Akyegane Avatar answered Sep 20 '22 08:09

Akyegane


Check below article / answer for the detail :

SqlGeography and Linq to Sql

Is it possible to use SqlGeography with Linq to Sql?

Spatial types are not supported by Linq to SQL. Support is not "not great" - it's nonexistent.

You can read them as BLOBs, but you can't do that by simply changing the column type in Linq to SQL. You need to alter your queries at the database level to return the column as a varbinary, using the CAST statement. You can do this at the table level by adding a computed varbinary column, which Linq will happily map to a byte[].

like image 41
Pranay Rana Avatar answered Sep 18 '22 08:09

Pranay Rana