1 //------------------------------------------------------------------------------
2 // <copyright file="SqlSpatialServices.cs" company="Microsoft">
3 // Copyright (c) Microsoft Corporation. All rights reserved.
7 // @backupOwner Microsoft
8 //------------------------------------------------------------------------------
10 namespace System.Data.Spatial.Internal
15 internal static class SpatialExceptions
17 internal static ArgumentNullException ArgumentNull(string argumentName)
20 return EntityUtil.ArgumentNull(argumentName);
23 internal static Exception ProviderValueNotCompatibleWithSpatialServices()
26 return EntityUtil.Argument(System.Data.Entity.Strings.Spatial_ProviderValueNotCompatibleWithSpatialServices, "providerValue");
30 /// Thrown whenever DbGeograpy/DbGeometry.WellKnownValue is set after regular construction (not deserialization instantiation).
32 /// <returns><see cref="InvalidOperationException"/></returns>
33 internal static InvalidOperationException WellKnownValueSerializationPropertyNotDirectlySettable()
36 return EntityUtil.InvalidOperation(System.Data.Entity.Strings.Spatial_WellKnownValueSerializationPropertyNotDirectlySettable);
39 #region Geography-specific exceptions
41 internal static Exception GeographyValueNotCompatibleWithSpatialServices(string argumentName)
44 return EntityUtil.Argument(System.Data.Entity.Strings.Spatial_GeographyValueNotCompatibleWithSpatialServices, argumentName);
47 internal static Exception WellKnownGeographyValueNotValid(string argumentName)
50 return EntityUtil.Argument(System.Data.Entity.Strings.Spatial_WellKnownGeographyValueNotValid, argumentName);
53 internal static Exception CouldNotCreateWellKnownGeographyValueNoSrid(string argumentName)
56 return EntityUtil.Argument(System.Data.Entity.Strings.SqlSpatialservices_CouldNotCreateWellKnownGeographyValueNoSrid, argumentName);
59 internal static Exception CouldNotCreateWellKnownGeographyValueNoWkbOrWkt(string argumentName)
62 return EntityUtil.Argument(System.Data.Entity.Strings.SqlSpatialservices_CouldNotCreateWellKnownGeographyValueNoWkbOrWkt, argumentName);
67 #region Geometry-specific exceptions
69 internal static Exception GeometryValueNotCompatibleWithSpatialServices(string argumentName)
72 return EntityUtil.Argument(System.Data.Entity.Strings.Spatial_GeometryValueNotCompatibleWithSpatialServices, argumentName);
75 internal static Exception WellKnownGeometryValueNotValid(string argumentName)
78 throw EntityUtil.Argument(System.Data.Entity.Strings.Spatial_WellKnownGeometryValueNotValid, argumentName);
81 internal static Exception CouldNotCreateWellKnownGeometryValueNoSrid(String argumentName)
84 return EntityUtil.Argument(System.Data.Entity.Strings.SqlSpatialservices_CouldNotCreateWellKnownGeometryValueNoSrid, argumentName);
87 internal static Exception CouldNotCreateWellKnownGeometryValueNoWkbOrWkt(String argumentName)
90 return EntityUtil.Argument(System.Data.Entity.Strings.SqlSpatialservices_CouldNotCreateWellKnownGeometryValueNoWkbOrWkt, argumentName);
95 #region SqlSpatialServices-specific Exceptions
97 internal static Exception SqlSpatialServices_ProviderValueNotSqlType(Type requiredType)
99 return EntityUtil.Argument(System.Data.Entity.Strings.SqlSpatialServices_ProviderValueNotSqlType(requiredType.AssemblyQualifiedName), "providerValue");