Beispiel #1
0
        internal static object GetSpatialValue(
            MetadataWorkspace workspace,
            DbDataReader reader,
            TypeUsage columnType,
            int columnOrdinal)
        {
            DbSpatialDataReader spatialDataReader = SpatialHelpers.CreateSpatialDataReader(workspace, reader);

            if (Helper.IsGeographicType((PrimitiveType)columnType.EdmType))
            {
                return((object)spatialDataReader.GetGeography(columnOrdinal));
            }
            return((object)spatialDataReader.GetGeometry(columnOrdinal));
        }
Beispiel #2
0
        internal static async Task <object> GetSpatialValueAsync(
            MetadataWorkspace workspace,
            DbDataReader reader,
            TypeUsage columnType,
            int columnOrdinal,
            CancellationToken cancellationToken)
        {
            cancellationToken.ThrowIfCancellationRequested();
            DbSpatialDataReader spatialReader = SpatialHelpers.CreateSpatialDataReader(workspace, reader);

            if (Helper.IsGeographicType((PrimitiveType)columnType.EdmType))
            {
                return((object)await spatialReader.GetGeographyAsync(columnOrdinal, cancellationToken).WithCurrentCulture <DbGeography>());
            }
            return((object)await spatialReader.GetGeometryAsync(columnOrdinal, cancellationToken).WithCurrentCulture <DbGeometry>());
        }