Exemplo n.º 1
0
        /// <summary>Converts the specified <paramref name="geometry" /> into a <see cref="SqlGeography" />.</summary>
        /// <param name="geometry">The geometry to convert.</param>
        /// <returns>The converted geometry.</returns>
        public static SqlGeography ToGeography(ISimpleGeometry geometry)
        {
            var sg = geometry as SqlGeography;

            if (sg != null)
            {
                return(sg);
            }

            var sgb = new SqlGeographyBuilderWrapper();

            geometry.Populate(sgb);
            return(sgb.ConstructedGeometry);
        }
Exemplo n.º 2
0
        /// <summary>Converts the specified <paramref name="geometry" /> into a <see cref="SqlGeography" />.</summary>
        /// <param name="geometry">The geometry to convert.</param>
        /// <returns>The converted geometry.</returns>
        public static SqlGeography ToGeography(ISimpleGeometry geometry)
        {
            var sg=geometry as SqlGeography;
            if (sg!=null)
                return sg;

            var sgb=new SqlGeographyBuilderWrapper();
            geometry.Populate(sgb);
            return sgb.ConstructedGeometry;
        }