/// <inheritdoc/>
        public override DbGeography GetGeography(int ordinal)
        {
            EnsureGeographyColumn(ordinal);
            var geogBytes     = _reader.GetSqlBytes(ordinal);
            var providerValue = _sqlGeographyFromBinaryReader.Value(new BinaryReader(geogBytes.Stream));

            return(_spatialServices.GeographyFromProviderValue(providerValue));
        }
Esempio n. 2
0
        public void Verify_DbGeography_FromProviderValue_method()
        {
            var providerValue = spatialServices.GeographyFromText(PointWKT).ProviderValue;

            Assert.Equal(
                PointWKT,
                spatialServices.GeographyFromProviderValue(providerValue).AsText());
        }
        private static object GetSpatialValueFromProviderValue(
            object spatialValue,
            PrimitiveType parameterType,
            EntityConnection connection)
        {
            DbSpatialServices spatialServices = DbProviderServices.GetSpatialServices(DbConfiguration.DependencyResolver, connection);

            if (Helper.IsGeographicType(parameterType))
            {
                return((object)spatialServices.GeographyFromProviderValue(spatialValue));
            }
            return((object)spatialServices.GeometryFromProviderValue(spatialValue));
        }
Esempio n. 4
0
        private static object GetSpatialValueFromProviderValue(object spatialValue, PrimitiveType parameterType, EntityConnection connection)
        {
            DbProviderServices  providerServices    = DbProviderServices.GetProviderServices(connection.StoreConnection);
            StoreItemCollection storeItemCollection = (StoreItemCollection)connection.GetMetadataWorkspace().GetItemCollection(DataSpace.SSpace);
            DbSpatialServices   spatialServices     = providerServices.GetSpatialServices(storeItemCollection.StoreProviderManifestToken);

            if (Helper.IsGeographicType(parameterType))
            {
                return(spatialServices.GeographyFromProviderValue(spatialValue));
            }
            else
            {
                Debug.Assert(Helper.IsGeometricType(parameterType));
                return(spatialServices.GeometryFromProviderValue(spatialValue));
            }
        }