Search code examples
visual-studio-2010linq-to-sqlsqlgeography

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.


Solution

  • 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[].