Beispiel #1
0
 private static DefaultSpatialServices.ReadOnlySpatialValues CheckProviderValue(
     object providerValue)
 {
     DefaultSpatialServices.ReadOnlySpatialValues onlySpatialValues = providerValue as DefaultSpatialServices.ReadOnlySpatialValues;
     if (onlySpatialValues == null)
     {
         throw new ArgumentException(Strings.Spatial_ProviderValueNotCompatibleWithSpatialServices, nameof(providerValue));
     }
     return(onlySpatialValues);
 }
Beispiel #2
0
 public override DbGeographyWellKnownValue CreateWellKnownValue(
     DbGeography geographyValue)
 {
     Check.NotNull <DbGeography>(geographyValue, nameof(geographyValue));
     DefaultSpatialServices.ReadOnlySpatialValues onlySpatialValues = DefaultSpatialServices.CheckCompatible(geographyValue);
     return(new DbGeographyWellKnownValue()
     {
         CoordinateSystemId = onlySpatialValues.CoordinateSystemId,
         WellKnownBinary = onlySpatialValues.CloneBinary(),
         WellKnownText = onlySpatialValues.Text
     });
 }
Beispiel #3
0
 private static DefaultSpatialServices.ReadOnlySpatialValues CheckCompatible(
     DbGeometry geometryValue)
 {
     if (geometryValue != null)
     {
         DefaultSpatialServices.ReadOnlySpatialValues providerValue = geometryValue.ProviderValue as DefaultSpatialServices.ReadOnlySpatialValues;
         if (providerValue != null)
         {
             return(providerValue);
         }
     }
     throw new ArgumentException(Strings.Spatial_GeometryValueNotCompatibleWithSpatialServices, nameof(geometryValue));
 }