本文整理汇总了C#中System.Data.Entity.Spatial.DbGeography类的典型用法代码示例。如果您正苦于以下问题:C# DbGeography类的具体用法?C# DbGeography怎么用?C# DbGeography使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DbGeography类属于System.Data.Entity.Spatial命名空间,在下文中一共展示了DbGeography类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreatePoint
public static GeoLocation CreatePoint(DbGeography location)
{
var geoLocation = new GeoLocation();
geoLocation.Latitude = location.Latitude.Value;
geoLocation.Longitude = location.Longitude.Value;
return geoLocation;
}
示例2: SpatialGeography
internal SpatialGeography(DbGeography g, ICoordinateSystem coordinateSystem)
{
Debug.Assert(g!=null);
if (g==null)
throw new ArgumentNullException("g");
_Geography=g;
_CoordinateSystem=coordinateSystem;
}
示例3: SuppliersWithinRangeUsingPoint
public virtual IQueryable<SupplierWithLocation> SuppliersWithinRangeUsingPoint(int? miles, DbGeography location)
{
var objectContext = ((IObjectContextAdapter)this).ObjectContext;
objectContext.MetadataWorkspace.LoadFromAssembly(typeof(SupplierWithLocation).Assembly);
return objectContext.CreateQuery<SupplierWithLocation>("[SpatialNorthwindContext].[SuppliersWithinRangeUsingPoint](@miles, @location)",
new ObjectParameter("miles", miles),
new ObjectParameter("location", location));
}
示例4: GetGeographyAsync_calls_GetGeography
public void GetGeographyAsync_calls_GetGeography()
{
var mockDbSpatialDataReader = new Mock<DbSpatialDataReader> { CallBase = true };
var dbGeography = new DbGeography();
mockDbSpatialDataReader.Setup(m => m.GetGeography(0)).Returns((int ordinal) => dbGeography).Verifiable();
var task = mockDbSpatialDataReader.Object.GetGeographyAsync(0, CancellationToken.None);
mockDbSpatialDataReader.Verify(m => m.GetGeography(0), Times.Once());
Assert.Same(dbGeography, task.Result);
}
示例5: CheckCompatible
private static ReadOnlySpatialValues CheckCompatible(DbGeography geographyValue)
{
Debug.Assert(geographyValue != null, "Validate geographyValue is non-null before calling CheckCompatible");
if (geographyValue != null)
{
var expectedValue = geographyValue.ProviderValue as ReadOnlySpatialValues;
if (expectedValue != null)
{
return expectedValue;
}
}
throw new ArgumentException(Strings.Spatial_GeographyValueNotCompatibleWithSpatialServices, "geographyValue");
}
示例6: CheckCompatible
private static ReadOnlySpatialValues CheckCompatible(DbGeography geographyValue)
{
DebugCheck.NotNull(geographyValue);
if (geographyValue != null)
{
var expectedValue = geographyValue.ProviderValue as ReadOnlySpatialValues;
if (expectedValue != null)
{
return expectedValue;
}
}
throw new ArgumentException(Strings.Spatial_GeographyValueNotCompatibleWithSpatialServices, "geographyValue");
}
示例7: Geography
public ParameterModel Geography(
DbGeography defaultValue = null,
string defaultValueSql = null,
string name = null,
string storeType = null,
bool outParameter = false)
{
return BuildParameter(
PrimitiveTypeKind.Geography,
defaultValue,
defaultValueSql,
name: name,
storeType: storeType,
outParameter: outParameter);
}
示例8: SymmetricDifference
/// <summary> Computes the symmetric difference of this DbGeography value and another DbGeography value. </summary>
/// <returns>A new DbGeography value representing the symmetric difference between this geography value and other.</returns>
/// <param name="other">The geography value for which the symmetric difference with this value should be computed.</param>
public DbGeography SymmetricDifference(DbGeography other)
{
Check.NotNull(other, "other");
return _spatialProvider.SymmetricDifference(this, other);
}
示例9: Distance
/// <summary> Computes the distance between the closest points in this DbGeography value and another DbGeography value. </summary>
/// <returns>A double value that specifies the distance between the two closest points in this geography value and other.</returns>
/// <param name="other">The geography value for which the distance from this value should be computed.</param>
public double? Distance(DbGeography other)
{
Check.NotNull(other, "other");
return _spatialProvider.Distance(this, other);
}
示例10: Disjoint
/// <summary> Determines whether this DbGeography is spatially disjoint from the specified DbGeography argument. </summary>
/// <returns>true if other is disjoint from this geography value; otherwise false.</returns>
/// <param name="other">The geography value that should be compared with this geography value for disjointness.</param>
public bool Disjoint(DbGeography other)
{
Check.NotNull(other, "other");
return _spatialProvider.Disjoint(this, other);
}
示例11: NumRings
public static Int32? NumRings(DbGeography geographyValue)
{
throw new NotSupportedException(Strings.ELinq_DbFunctionDirectCall);
}
示例12: Filter
public static Boolean? Filter(DbGeography geographyValue, DbGeography geographyOther)
{
throw new NotSupportedException(Strings.ELinq_DbFunctionDirectCall);
}
示例13: PointAt
/// <summary>
/// Returns a point element of the given <see cref="T:System.Data.Entity.Spatial.DbGeography" /> value, if it represents a linestring or linear ring.
/// </summary>
/// <returns>The point in geographyValue at position index, if it represents a linestring or linear ring; otherwise null.</returns>
/// <param name="geographyValue">The geography value, which need not represent a linestring or linear ring.</param>
/// <param name="index">The position within the geography value from which the element should be taken.</param>
/// <exception cref="ArgumentNullException">
/// <paramref name="geographyValue" />
/// is null.
/// </exception>
/// <exception cref="ArgumentException">
/// <paramref name="geographyValue" />
/// is not compatible with this spatial services implementation.
/// </exception>
public abstract DbGeography PointAt(DbGeography geographyValue, int index);
示例14: GetPointCount
/// <summary>
/// Returns the number of points in the given <see cref="T:System.Data.Entity.Spatial.DbGeography" /> value, if it represents a linestring or linear ring.
/// </summary>
/// <returns>
/// The number of points in the given <see cref="T:System.Data.Entity.Spatial.DbGeography" /> value.
/// </returns>
/// <param name="geographyValue">The geography value, which need not represent a linestring or linear ring.</param>
/// <exception cref="ArgumentNullException">
/// <paramref name="geographyValue" />
/// is null.
/// </exception>
/// <exception cref="ArgumentException">
/// <paramref name="geographyValue" />
/// is not compatible with this spatial services implementation.
/// </exception>
public abstract int? GetPointCount(DbGeography geographyValue);
示例15: BufferWithTolerance
public static DbGeography BufferWithTolerance(DbGeography geographyValue, Double? distance, Double? tolerance, Boolean? relative)
{
throw new NotSupportedException(Strings.ELinq_DbFunctionDirectCall);
}