Class DataSourceEnumerationQuery
Namespace: Casewhere.Runtime.DSL.Api
Assembly: Casewhere.Runtime.dll
The DataSourceEnumerationQuery contains Filter, ProjectedFields, SortedFields, DataSourceName, BatchSize data. These info used to build query directly to database. The one create by a static method DataSourceEnumerationQuery.For().
public class DataSourceEnumerationQuery
Inheritance
object ← DataSourceEnumerationQuery
Inherited Members
object.ToString(), object.Equals(object), object.Equals(object, object), object.ReferenceEquals(object, object), object.GetHashCode(), object.GetType(), object.MemberwiseClone()
Extension Methods
ObjectExtension.ConvertToBsonValue(object), EnumExtensions.DeepClone<DataSourceEnumerationQuery>(DataSourceEnumerationQuery)
Examples
var filter = FilterBuilder.Create().Eq("DepartmentId", ctx.Input.Id).Eq("Active", true).Build();
var query = DataSourceEnumerationQuery.For("Employee")
.FilterBy(filter)
.ProjectOn("FirstName", "LastName")
.OrderBy("FirstName", true);
var result = ctx.Use<IDataApi>().Enumerate(query);
Properties
BatchSize
Amount documents per batch. The default value is 100.
public int BatchSize { get; protected set; }
Property Value
CustomCollation
This parameter specifies the custom collation for the query.
public CustomCollation CustomCollation { get; set; }
Property Value
CustomCollation
DataSourceName
The name of the data source
public string DataSourceName { get; }
Property Value
DataSourceParameters
The Parameters that passed to the data source query.
public Dictionary<string, object> DataSourceParameters { get; set; }
Property Value
Filter
The filter object that is built using Casewhere.Runtime.DataObjectExpressions.DSL.FilterBuilder.
public DynamicFilter Filter { get; set; }
Property Value
DynamicFilter
GeoSpatialStages
public IList<BsonDocument> GeoSpatialStages { get; set; }
Property Value
IList<BsonDocument>
HintIndexName
The hint index name specified for the query.
public string HintIndexName { get; set; }
Property Value
ProjectedFields
The list of fields returned to Client. By default, Casewhere will return all.
public IList<string> ProjectedFields { get; set; }
Property Value
SortedFields
List of sorted fields.
public IList<SortField> SortedFields { get; set; }
Property Value
IList<SortField>
Methods
FilterBy(DynamicFilter)
Set query filter. For chaining purpose.
public DataSourceEnumerationQuery FilterBy(DynamicFilter filter)
Parameters
filter
DynamicFilter
The filter is an instance of DynamicFilter. It can be built by Casewhere.Runtime.DataObjectExpressions.DSL.FilterBuilder
Returns
The current instance of the DataSourceEnumerationQuery type with its filter data
FilterBy(object)
Set query filter. For chaining purpose.
public DataSourceEnumerationQuery FilterBy(object filter)
Parameters
filter
object
The filter is an instance of DynamicFilter. It can be built by Casewhere.Runtime.DataObjectExpressions.DSL.FilterBuilder
Returns
The current instance of the DataSourceEnumerationQuery type with its filter data
For(string)
The static For method use to create a new instance of Casewhere.Runtime.DSL.Api.DataSourceEnumerationQuery type.
public static DataSourceEnumerationQuery For(string dataSourceName)
Parameters
dataSourceName
string
The name of the data source
Returns
A new instance of the DataSourceEnumerationQuery type
GeoNear(string, GeoJsonObject, double?, double?)
Create a geospatial queries that find documents near a specific location, taking distance constraints into account.
public DataSourceEnumerationQuery GeoNear(string field, GeoJsonObject value, double? maxDistance = 0, double? minDistance = 0)
Parameters
field
string
This parameter specifies the name of the field in your documents that contains location data or coordinates.
value
GeoJsonObject
A GeoJsonObject geometry for use with the following geospatial query operators.
maxDistance
double?
This parameter specifies the maximum distance within which to find documents. It defaults to 0 if not provided.
minDistance
double?
This parameter specifies the minimum distance from the target location. It defaults to 0 if not provided.
Returns
The query object itself for chaining purpose.
GeoNearSphere(string, GeoJsonObject, double?, double?)
Create a geospatial query for finding documents near a specific geographic location, emphasizing spherical calculations.
public DataSourceEnumerationQuery GeoNearSphere(string field, GeoJsonObject value, double? maxDistance = 0, double? minDistance = 0)
Parameters
field
string
This parameter specifies the name of the field in your documents that contains location data or coordinates.
value
GeoJsonObject
A GeoJsonObject geometry for use with the following geospatial query operators.
maxDistance
double?
This parameter specifies the maximum distance within which to find documents. It defaults to 0 if not provided.
minDistance
double?
This parameter specifies the minimum distance from the target location. It defaults to 0 if not provided.
Returns
The query object itself for chaining purpose.
Near(string, double, double, double?, double?)
Create a geospatial queries that find documents near a specific location, taking distance constraints into account.
public DataSourceEnumerationQuery Near(string field, double x, double y, double? maxDistance = 0, double? minDistance = 0)
Parameters
field
string
This parameter specifies the name of the field in your documents that contains location data or coordinates.
x
double
The parameter represent the longitude.
y
double
The parameter represent the latitude.
maxDistance
double?
This parameter specifies the maximum distance within which to find documents. It defaults to 0 if not provided.
minDistance
double?
This parameter specifies the minimum distance from the target location. It defaults to 0 if not provided.
Returns
The query object itself for chaining purpose.
NearSphere(string, double, double, double?, double?)
Create a geospatial query for finding documents near a specific geographic location, emphasizing spherical calculations.
public DataSourceEnumerationQuery NearSphere(string field, double x, double y, double? maxDistance = 0, double? minDistance = 0)
Parameters
field
string
This parameter specifies the name of the field in your documents that contains location data or coordinates.
x
double
The parameter represent the longitude.
y
double
The parameter represent the latitude.
maxDistance
double?
This parameter specifies the maximum distance within which to find documents. It defaults to 0 if not provided.
minDistance
double?
This parameter specifies the minimum distance from the target location. It defaults to 0 if not provided.
Returns
The query object itself for chaining purpose.
OrderBy(string, bool)
Set query sorting. For chaining purpose.
public DataSourceEnumerationQuery OrderBy(string name, bool asc = true)
Parameters
name
string
Specifies the field name to be order by
asc
bool
Specifies order directions is ascending or descending.
Returns
The current instance of the DataSourceEnumerationQuery type with its Order data
ProjectOn(params string[])
Set query projection. For chaining purpose.
public DataSourceEnumerationQuery ProjectOn(params string[] fieldNames)
Parameters
fieldNames
string[]
The projection fields is string array used to specify queried fields
Returns
The current instance of the DataSourceEnumerationQuery type with its Projection data
SetBatchSize(int)
Set batch size to the existing query.
public DataSourceEnumerationQuery SetBatchSize(int batchSize)
Parameters
batchSize
int
Specifies the number of data objects to return in each batch
Returns
The current instance of the DataSourceEnumerationQuery type with its batch size data
SetHintIndex(string)
Specify a hint index name for this query.
public DataSourceEnumerationQuery SetHintIndex(string hintIdexName)
Parameters
hintIdexName
string
The hint index name
Returns
The query object itself for chaining purpose.
SetParameter(string, object)
Add a parameter into the parameters of the query.
public DataSourceEnumerationQuery SetParameter(string key, object value)
Parameters
key
string
Key of the parameter that added into the parameters of data source query.
value
object
Value of the parameter that added into the parameters of data source query.
Returns
The query object itself for chaining purpose.
SetParameters(Dictionary<string, object>)
Set parameters for the query.
public DataSourceEnumerationQuery SetParameters(Dictionary<string, object> parameters)
Parameters
parameters
Dictionary<string, object>
Specify the parameters that passed to the data source query.
Returns
The query object itself for chaining purpose.
ToEnumerationDataSourceQuery()
public virtual EnumerationDataSourceQuery ToEnumerationDataSourceQuery()
Returns
WithCustomCollation(string, int)
Specify a custom collation for this query. If not specified, the data source's collation will be used, if not specified too, the default collation will be used.
public DataSourceEnumerationQuery WithCustomCollation(string collationLocale, int collationStrength)
Parameters
collationLocale
string
This parameter specifies the locale of the custom collation.
collationStrength
int
This parameter specifies the strengh of the custom collation.
Returns
The query object itself for chaining purpose.