Wednesday, January 18, 2012

Geography Support in Linq-to-SQL

SqlGeography Data Type support in Linq to Sql

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

Problem Cause: 
                    Its a case when we use spatial data types(Geometry,Geography) supported by sql server 2008 in LINQ to SQL.

    Step:1 Create a view that is based on the desired table and that does not include the  unsupported data type i.e.
 A.     just include the column as:
          CAST(geography_column AS VARBINARY(MAX))
B.    Create 3 different columns for Latitude,Longitude and Zoom from single GeoCode column.
        GeoCode.Lat as Latitude, GeoCode.Long AS Longitude, GeoCode.Z as Zoom 
        here GeoCode is column with type Geography in table that is not supported by Linq to Sql

 Step 2:   Drag the view from Server Explorer/Database Explorer onto the designer.


Anonymous said...

Hello! I'm at work surfing around your blog from my new iphone 3gs! Just wanted to say I love reading through your blog and look forward to all your posts! Keep up the excellent work!
Visit my blog post : microsoft Surface pros and cons

Twitter Delicious Facebook Digg Stumbleupon Favorites More

Powered by Code Imagine