What distinguishes these two objects, which in a Microsoft SQL Database reflect the same geography datatype, or what is their intended use?
They cannot be placed together, yet
has more control over producing points, polygons, etc.
I believe that
is solely intended for usage with Entity Framework, whereas
used in conjunction with the
You're right; it really is that easy. Simply put, the DbGeography is a SqlGeography that has been simplified in order to fit within the Enterprise Framework. Although not all of SqlGeography's methods have been implemented, you correctly point out that the majority have.
Although the two types cannot be cast directly into one another, doing so is a very straightforward process when the extra functionality of SqlGeography is needed.
SqlGeography geog1 = SqlGeography.STPolyFromText('<coords>', srid); SqlGeography geog2; DbGeography dbGeog; // SqlGeography to DbGeography dbGeog = DbGeography.FromText(geog1.ToString(), srid); // DbGeography to SqlGeography geog2 = SqlGeography.Parse(dbGeog.AsText());