开发者

C# and SQLGeometry: Combining Database Rows and WPF

开发者 https://www.devze.com 2023-03-13 12:48 出处:网络
I\'m pretty sure I want to use the SqlGeometry datatype to store a bunch of polygons in a database. Doe开发者_如何学JAVAs the SqlGeometry type inter-operate into C# and WPF.Can you just directly cast

I'm pretty sure I want to use the SqlGeometry datatype to store a bunch of polygons in a database. Doe开发者_如何学JAVAs the SqlGeometry type inter-operate into C# and WPF. Can you just directly cast an SqlGeometry to a Shape or Path?

Secondly, Is it possible to store more than 1 polygon in a single SqlGeometry column?


This link shows how to view SqlGeometry visually in C#: http://www.codeproject.com/KB/database/sqlgeometry.aspx

This link shows how to manipulate SqlGeometry data types in C#: http://www.nickharris.net/tag/geometry-data-type/

Regarding multiple polygons per SqlGemotry column, I don't think you can do this per: http://barendgehrels.blogspot.com/2011_04_01_archive.html which converts multi-geometry to a list of SqlGeometry.


SqlGeometry and WPF Geometries are independent libraries. You would need to do a conversion.

You can only store one geometry per column, but a geometry can be an MultiPolygon or a GeometryCollection. Both are ways to store more Polygons in one column. So, yes.

0

精彩评论

暂无评论...
验证码 换一张
取 消