Imported Upstream version 4.6.0.125

Former-commit-id: a2155e9bd80020e49e72e86c44da02a8ac0e57a4
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2016-08-03 10:59:49 +00:00
parent a569aebcfd
commit e79aa3c0ed
17047 changed files with 3137615 additions and 392334 deletions

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,43 @@
//---------------------------------------------------------------------
// <copyright file="DbGeographyWellKnownValue.cs" company="Microsoft">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
//
// @owner willa
// @backupOwner [....]
//---------------------------------------------------------------------
using System.Runtime.Serialization;
namespace System.Data.Spatial
{
/// <summary>
/// A data contract serializable representation of a <see cref="DbGeography"/> value.
/// </summary>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "Db")]
[DataContract]
public sealed class DbGeographyWellKnownValue
{
public DbGeographyWellKnownValue()
{
}
/// <summary>
/// Gets or sets the coordinate system identifier (SRID) of this value.
/// </summary>
[DataMember(Order=1, IsRequired=false, EmitDefaultValue=false)]
public int CoordinateSystemId { get; set; }
/// <summary>
/// Gets or sets the well known text representation of this value.
/// </summary>
[DataMember(Order=2, IsRequired=false, EmitDefaultValue=false)]
public string WellKnownText { get; set; }
/// <summary>
/// Gets or sets the well known binary representation of this value.
/// </summary>
[DataMember(Order = 3, IsRequired = false, EmitDefaultValue = false)]
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays", Justification = "Required for this feature")]
public byte[] WellKnownBinary { get; set; }
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,44 @@
//---------------------------------------------------------------------
// <copyright file="DbSpatialWellKnownValue.cs" company="Microsoft">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
//
// @owner willa
// @backupOwner [....]
//---------------------------------------------------------------------
using System.Runtime.Serialization;
namespace System.Data.Spatial
{
/// <summary>
/// A data contract serializable representation of a <see cref="DbGeometry"/> value.
/// </summary>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "Db")]
[DataContract]
public sealed class DbGeometryWellKnownValue
{
public DbGeometryWellKnownValue()
{
}
/// <summary>
/// Gets or sets the coordinate system identifier (SRID) of this value.
/// </summary>
[DataMember(Order=1, IsRequired=false, EmitDefaultValue=false)]
public int CoordinateSystemId { get; set; }
/// <summary>
/// Gets or sets the well known text representation of this value.
/// </summary>
[DataMember(Order=2, IsRequired=false, EmitDefaultValue=false)]
public string WellKnownText { get; set; }
/// <summary>
/// Gets or sets the well known binary representation of this value.
/// </summary>
[DataMember(Order = 3, IsRequired = false, EmitDefaultValue = false)]
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays", Justification = "Required for this feature")]
public byte[] WellKnownBinary { get; set; }
}
}

View File

@ -0,0 +1,32 @@
//---------------------------------------------------------------------
// <copyright file="IDbSpatialDataReader.cs" company="Microsoft">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
//
// @owner willa
// @backupOwner srimand
//---------------------------------------------------------------------
namespace System.Data.Spatial
{
/// <summary>
/// A provider-independent service API for geospatial (Geometry/Geography) type support.
/// </summary>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "Db")]
public abstract class DbSpatialDataReader
{
/// <summary>
/// When implemented in derived types, reads an instance of <see cref="DbGeography"/> from the column at the specified column ordinal.
/// </summary>
/// <param name="ordinal">The ordinal of the column that contains the geography value</param>
/// <returns>The instance of DbGeography at the specified column value</returns>
public abstract DbGeography GetGeography(int ordinal);
/// <summary>
/// When implemented in derived types, reads an instance of <see cref="DbGeometry"/> from the column at the specified column ordinal.
/// </summary>
/// <param name="ordinal">The ordinal of the data record column that contains the provider-specific geometry data</param>
/// <returns>The instance of DbGeometry at the specified column value</returns>
public abstract DbGeometry GetGeometry(int ordinal);
}
}

View File

@ -0,0 +1 @@
e248ee0ca3ee56154fd16465c6fe12b555b16208

View File

@ -0,0 +1,24 @@
//------------------------------------------------------------------------------
// <copyright file="ExtensionMethods.cs" company="Microsoft">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
//
// @owner willa
// @backupOwner [....]
//------------------------------------------------------------------------------
using System.Data.Spatial.Internal;
namespace System.Data.Spatial
{
internal static class ExtensionMethods
{
internal static void CheckNull<T>(this T value, string argumentName) where T : class
{
if (value == null)
{
throw SpatialExceptions.ArgumentNull(argumentName);
}
}
}
}

View File

@ -0,0 +1,104 @@
//------------------------------------------------------------------------------
// <copyright file="SqlSpatialServices.cs" company="Microsoft">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
//
// @owner willa
// @backupOwner [....]
//------------------------------------------------------------------------------
namespace System.Data.Spatial.Internal
{
using System;
using System.Data;
internal static class SpatialExceptions
{
internal static ArgumentNullException ArgumentNull(string argumentName)
{
//
return EntityUtil.ArgumentNull(argumentName);
}
internal static Exception ProviderValueNotCompatibleWithSpatialServices()
{
//
return EntityUtil.Argument(System.Data.Entity.Strings.Spatial_ProviderValueNotCompatibleWithSpatialServices, "providerValue");
}
/// <summary>
/// Thrown whenever DbGeograpy/DbGeometry.WellKnownValue is set after regular construction (not deserialization instantiation).
/// </summary>
/// <returns><see cref="InvalidOperationException"/></returns>
internal static InvalidOperationException WellKnownValueSerializationPropertyNotDirectlySettable()
{
//
return EntityUtil.InvalidOperation(System.Data.Entity.Strings.Spatial_WellKnownValueSerializationPropertyNotDirectlySettable);
}
#region Geography-specific exceptions
internal static Exception GeographyValueNotCompatibleWithSpatialServices(string argumentName)
{
//
return EntityUtil.Argument(System.Data.Entity.Strings.Spatial_GeographyValueNotCompatibleWithSpatialServices, argumentName);
}
internal static Exception WellKnownGeographyValueNotValid(string argumentName)
{
//
return EntityUtil.Argument(System.Data.Entity.Strings.Spatial_WellKnownGeographyValueNotValid, argumentName);
}
internal static Exception CouldNotCreateWellKnownGeographyValueNoSrid(string argumentName)
{
//
return EntityUtil.Argument(System.Data.Entity.Strings.SqlSpatialservices_CouldNotCreateWellKnownGeographyValueNoSrid, argumentName);
}
internal static Exception CouldNotCreateWellKnownGeographyValueNoWkbOrWkt(string argumentName)
{
//
return EntityUtil.Argument(System.Data.Entity.Strings.SqlSpatialservices_CouldNotCreateWellKnownGeographyValueNoWkbOrWkt, argumentName);
}
#endregion
#region Geometry-specific exceptions
internal static Exception GeometryValueNotCompatibleWithSpatialServices(string argumentName)
{
//
return EntityUtil.Argument(System.Data.Entity.Strings.Spatial_GeometryValueNotCompatibleWithSpatialServices, argumentName);
}
internal static Exception WellKnownGeometryValueNotValid(string argumentName)
{
//
throw EntityUtil.Argument(System.Data.Entity.Strings.Spatial_WellKnownGeometryValueNotValid, argumentName);
}
internal static Exception CouldNotCreateWellKnownGeometryValueNoSrid(String argumentName)
{
//
return EntityUtil.Argument(System.Data.Entity.Strings.SqlSpatialservices_CouldNotCreateWellKnownGeometryValueNoSrid, argumentName);
}
internal static Exception CouldNotCreateWellKnownGeometryValueNoWkbOrWkt(String argumentName)
{
//
return EntityUtil.Argument(System.Data.Entity.Strings.SqlSpatialservices_CouldNotCreateWellKnownGeometryValueNoWkbOrWkt, argumentName);
}
#endregion
#region SqlSpatialServices-specific Exceptions
internal static Exception SqlSpatialServices_ProviderValueNotSqlType(Type requiredType)
{
return EntityUtil.Argument(System.Data.Entity.Strings.SqlSpatialServices_ProviderValueNotSqlType(requiredType.AssemblyQualifiedName), "providerValue");
}
#endregion
}
}

View File

@ -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;
}
}
}