更新时间:2023-11-28 23:43:04
我同意 Bojan 的观点,除非你使用实体框架?
I'd agree with Bojan, unless you are using the Entity Framework?
SqlGeometry 对象有一个 MakeValid() 函数,因此使用您的示例,允许在 DbGeography 和 SqlGeography 之间进行转换:
The SqlGeometry object has a MakeValid() function, so using your example, allowing for a convert between DbGeography and SqlGeography:
DbGeography geog;
SqlGeometry geom = SqlGeometry.STGeomFromWKB(new SqlBytes(geog.AsBinary()), 32637);
但是,除非您使用 EF,否则我建议您只使用 SqlGeometry 作为
However, unless you are using EF, I'd recommend simply using SqlGeometry as
希望有所帮助.