public override object CreateProviderValue(DbGeometryWellKnownValue wellKnownValue)
        {
            CheckParameterNotNull("wellKnownValue", wellKnownValue);

            if (wellKnownValue.WellKnownText != null)
            {
                return(InvokeStaticFunction(
                           SqlTypes.SqlGeometryType,
                           "STGeomFromText",
                           SqlTypes.SqlCharsFromString(wellKnownValue.WellKnownText),
                           wellKnownValue.CoordinateSystemId));
            }
            else if (wellKnownValue.WellKnownBinary != null)
            {
                return(InvokeStaticFunction(
                           SqlTypes.SqlGeometryType,
                           "STGeomFromWKB",
                           SqlTypes.SqlBytesFromByteArray(wellKnownValue.WellKnownBinary),
                           wellKnownValue.CoordinateSystemId));
            }
            else
            {
                throw new ArgumentException("wellKnownValue");
            }
        }
        public override DbGeometry GeometryFromText(string wellKnownText, int coordinateSystemId)
        {
            CheckParameterNotNull("wellKnownText", wellKnownText);

            var providerValue = InvokeStaticFunction(
                SqlTypes.SqlGeometryType,
                "STGeomFromText",
                SqlTypes.SqlCharsFromString(wellKnownText),
                coordinateSystemId);

            return(GeometryFromProviderValue(providerValue));
        }