Table of Contents

Class NpgsqlCubeDbFunctionsExtensions

Namespace
Microsoft.EntityFrameworkCore
Assembly
Npgsql.EntityFrameworkCore.PostgreSQL.dll

Provides extension methods for NpgsqlCube supporting PostgreSQL translation.

public static class NpgsqlCubeDbFunctionsExtensions
Inheritance
NpgsqlCubeDbFunctionsExtensions
Inherited Members

Remarks

Methods

ContainedBy(NpgsqlCube, NpgsqlCube)

Determines whether a cube is contained by another cube.

public static bool ContainedBy(this NpgsqlCube cube, NpgsqlCube other)

Parameters

cube NpgsqlCube

The cube to check.

other NpgsqlCube

The cube that may contain it.

Returns

bool

true if cube is contained by other; otherwise, false.

Exceptions

InvalidOperationException

ContainedBy(NpgsqlCube, NpgsqlCube) is only intended for use via SQL translation as part of an EF Core LINQ query.

Contains(NpgsqlCube, NpgsqlCube)

Determines whether a cube contains another cube.

public static bool Contains(this NpgsqlCube cube, NpgsqlCube other)

Parameters

cube NpgsqlCube

The cube to check.

other NpgsqlCube

The cube that may be contained.

Returns

bool

true if cube contains other; otherwise, false.

Exceptions

InvalidOperationException

Contains(NpgsqlCube, NpgsqlCube) is only intended for use via SQL translation as part of an EF Core LINQ query.

Distance(NpgsqlCube, NpgsqlCube)

Computes the Euclidean distance between two cubes.

public static double Distance(this NpgsqlCube cube, NpgsqlCube other)

Parameters

cube NpgsqlCube

The first cube.

other NpgsqlCube

The second cube.

Returns

double

The Euclidean distance between the two cubes.

Exceptions

InvalidOperationException

Distance(NpgsqlCube, NpgsqlCube) is only intended for use via SQL translation as part of an EF Core LINQ query.

DistanceChebyshev(NpgsqlCube, NpgsqlCube)

Computes the Chebyshev (L-inf metric) distance between two cubes.

public static double DistanceChebyshev(this NpgsqlCube cube, NpgsqlCube other)

Parameters

cube NpgsqlCube

The first cube.

other NpgsqlCube

The second cube.

Returns

double

The Chebyshev distance between the two cubes.

Exceptions

InvalidOperationException

DistanceChebyshev(NpgsqlCube, NpgsqlCube) is only intended for use via SQL translation as part of an EF Core LINQ query.

DistanceTaxicab(NpgsqlCube, NpgsqlCube)

Computes the taxicab (L-1 metric) distance between two cubes.

public static double DistanceTaxicab(this NpgsqlCube cube, NpgsqlCube other)

Parameters

cube NpgsqlCube

The first cube.

other NpgsqlCube

The second cube.

Returns

double

The taxicab distance between the two cubes.

Exceptions

InvalidOperationException

DistanceTaxicab(NpgsqlCube, NpgsqlCube) is only intended for use via SQL translation as part of an EF Core LINQ query.

Enlarge(NpgsqlCube, double, int)

Increases the size of a cube by a specified radius in at least the specified number of dimensions.

public static NpgsqlCube Enlarge(this NpgsqlCube cube, double radius, int dimensions)

Parameters

cube NpgsqlCube

The cube to enlarge.

radius double

The amount by which to enlarge the cube (can be negative to shrink).

dimensions int

The number of dimensions to enlarge (optional, defaults to all dimensions).

Returns

NpgsqlCube

The enlarged (or shrunk) cube.

Remarks

If the specified number of dimensions is greater than the cube's current dimensions, the extra dimensions are added with the specified radius.

Exceptions

InvalidOperationException

Enlarge(NpgsqlCube, double, int) is only intended for use via SQL translation as part of an EF Core LINQ query.

Intersect(NpgsqlCube, NpgsqlCube)

Computes the intersection of two cubes.

public static NpgsqlCube Intersect(this NpgsqlCube cube, NpgsqlCube other)

Parameters

cube NpgsqlCube

The first cube.

other NpgsqlCube

The second cube.

Returns

NpgsqlCube

The intersection of the two cubes.

Exceptions

InvalidOperationException

Intersect(NpgsqlCube, NpgsqlCube) is only intended for use via SQL translation as part of an EF Core LINQ query.

NthCoordinate(NpgsqlCube, int)

Extracts the n-th coordinate of the cube.

public static double NthCoordinate(this NpgsqlCube cube, int index)

Parameters

cube NpgsqlCube

The cube.

index int

The coordinate index to extract.

Returns

double

The coordinate value at the specified index.

Remarks

This method uses zero-based indexing (C# convention), which is translated to PostgreSQL's one-based indexing.

Exceptions

InvalidOperationException

NthCoordinate(NpgsqlCube, int) is only intended for use via SQL translation as part of an EF Core LINQ query.

NthCoordinateKnn(NpgsqlCube, int)

Extracts the n-th coordinate of the cube for K-nearest neighbor (KNN) indexing.

public static double NthCoordinateKnn(this NpgsqlCube cube, int index)

Parameters

cube NpgsqlCube

The cube.

index int

The coordinate index to extract.

Returns

double

The coordinate value at the specified index.

Remarks

This method uses zero-based indexing (C# convention), which is translated to PostgreSQL's one-based indexing.

This is the same as NthCoordinate(NpgsqlCube, int) except it is marked "lossy" for GiST indexing purposes, which is useful for K-nearest neighbor queries.

Exceptions

InvalidOperationException

NthCoordinateKnn(NpgsqlCube, int) is only intended for use via SQL translation as part of an EF Core LINQ query.

Overlaps(NpgsqlCube, NpgsqlCube)

Determines whether two cubes overlap (have points in common).

public static bool Overlaps(this NpgsqlCube cube, NpgsqlCube other)

Parameters

cube NpgsqlCube

The first cube.

other NpgsqlCube

The second cube.

Returns

bool

true if the cubes overlap; otherwise, false.

Exceptions

InvalidOperationException

Overlaps(NpgsqlCube, NpgsqlCube) is only intended for use via SQL translation as part of an EF Core LINQ query.

Union(NpgsqlCube, NpgsqlCube)

Computes the union of two cubes, producing the smallest cube that encloses both.

public static NpgsqlCube Union(this NpgsqlCube cube, NpgsqlCube other)

Parameters

cube NpgsqlCube

The first cube.

other NpgsqlCube

The second cube.

Returns

NpgsqlCube

The smallest cube that encloses both input cubes.

Exceptions

InvalidOperationException

Union(NpgsqlCube, NpgsqlCube) is only intended for use via SQL translation as part of an EF Core LINQ query.