var x = DbGeography.PointFromText(string.Format("POINT({0} {1})", -45, 45), 4326);
抛出此异常...
System.NotImplementedException: The method or operation is not implemented.
at System.Data.Spatial.DefaultSpatialServices.GeographyPointFromText(String geographyText, Int32 spatialReferenceSystemId)
如果我安装完整的VS.NET 11 Beta,那么代码就能正常工作。有什么想法吗?缺少了什么?
答案更新
感谢Pawel。你需要安装SQL CLR类型。你可以在这个链接中获得2012版本:
Microsoft® System CLR Types for Microsoft® SQL Server® 2012 http://www.microsoft.com/download/en/details.aspx?id=29065 观点
我真的不明白为什么.NET框架依赖于SQL Server。这些类没有什么特别之处。我意识到这可能是一个历史问题,代码最初是由SQL团队编写的,而.NET团队想要重用它。这也不是一个基于提供程序的实现,更好的异常消息会节省一天的工作。