I need it for the unit test of MakeValid method. All I can find, is invalid text, which is not getting converted to the SqlGeography. So I need to create invalid SqlGeograpy object somehow.
using System.Data.SqlTypes; //use Nuget System.Data.SqlClient
using Microsoft.SqlServer.Types; //Microsoft.SqlServer.Types.dll
...
static void MakeValidTest() {
string pointString = "POINT (-112.11436060512261 33.860383682237021)";
var sqlString = new SqlString(pointString, 4326);
var sqlGeography = SqlGeography.Parse(sqlString); // how to get invalid Sql Geography???
sqlGeography = sqlGeography.MakeValid();
Console.WriteLine(sqlGeography);
}
PS Similar example with DbGeography, or with SQL could be also very helpful.. FYI: It's related to writing SQLCLR methods.