You've already forked linux-packaging-mono
Imported Upstream version 4.6.0.125
Former-commit-id: a2155e9bd80020e49e72e86c44da02a8ac0e57a4
This commit is contained in:
parent
a569aebcfd
commit
e79aa3c0ed
@ -0,0 +1,44 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <copyright file="SpatialHelpers.cs" company="Microsoft">
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// </copyright>
|
||||
//
|
||||
// @owner willa
|
||||
// @backupOwner [....]
|
||||
//------------------------------------------------------------------------------
|
||||
using System.Diagnostics;
|
||||
using System.Data.Metadata.Edm;
|
||||
using System.Data.Common;
|
||||
|
||||
namespace System.Data.Spatial
|
||||
{
|
||||
internal static class SpatialHelpers
|
||||
{
|
||||
internal static object GetSpatialValue(MetadataWorkspace workspace, DbDataReader reader, TypeUsage columnType, int columnOrdinal)
|
||||
{
|
||||
Debug.Assert(Helper.IsSpatialType(columnType));
|
||||
DbSpatialDataReader spatialReader = CreateSpatialDataReader(workspace, reader);
|
||||
if (Helper.IsGeographicType((PrimitiveType)columnType.EdmType))
|
||||
{
|
||||
return spatialReader.GetGeography(columnOrdinal);
|
||||
}
|
||||
else
|
||||
{
|
||||
return spatialReader.GetGeometry(columnOrdinal);
|
||||
}
|
||||
}
|
||||
|
||||
internal static DbSpatialDataReader CreateSpatialDataReader(MetadataWorkspace workspace, DbDataReader reader)
|
||||
{
|
||||
StoreItemCollection storeItemCollection = (StoreItemCollection)workspace.GetItemCollection(DataSpace.SSpace);
|
||||
DbProviderFactory providerFactory = storeItemCollection.StoreProviderFactory;
|
||||
Debug.Assert(providerFactory != null, "GetProviderSpatialServices requires provider factory to have been initialized");
|
||||
|
||||
DbProviderServices providerServices = DbProviderServices.GetProviderServices(providerFactory);
|
||||
DbSpatialDataReader result = providerServices.GetSpatialDataReader(reader, storeItemCollection.StoreProviderManifestToken);
|
||||
Debug.Assert(result != null, "DbProviderServices did not throw ProviderIncompatibleException for null IDbSpatialDataReader");
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user