Provides methods that get translated into native Realm queries when using LINQ.
Namespace: Realms Assembly: Realm.dll Syntaxpublic static class QueryMethods
Methods | Edit this page View Source Contains(string?, string, StringComparison)
Returns a value indicating whether a specified substring occurs within this string.
Declarationpublic static bool Contains(string? str, string value, StringComparison comparisonType)
Parameters Type Name Description string str
The original string.
string valueThe string to seek.
StringComparison comparisonTypeOne of the enumeration values that determines how this string and value are compared.
Returns Type Description booltrue
if the value parameter occurs within this string, or if value is the empty string (""); otherwise, false
.
Performs a 'simple term' Full-Text search on a string property.
Declarationpublic static bool FullTextSearch(string? str, string terms)
Parameters Type Name Description string str
The string to compare against the terms.
string termsThe terms to look for in str
.
true
if the string matches the terms; false
otherwise.
var matches = realm.All<Book>().Where(b => b.Summary.FullTextSearch("fantasy novel"));
| Edit this page View Source GeoWithin(IEmbeddedObject?, GeoShapeBase)
Checks whether geoShape
contains the point represented by an embedded object.
public static bool GeoWithin(IEmbeddedObject? point, GeoShapeBase geoShape)
Parameters Type Name Description IEmbeddedObject point
An embedded object that has the shape of a GeoJson point. It must have at least two fields - IList<double> coordinates
and string type
. The shape of the object will be verified at runtime.
One of GeoBox, GeoCircle, or GeoPolygon representing the shape that point
will be checked against.
true
if point
is contained in geoShape
; false
otherwise.
An example embedded object that can be used in geospatial queries is:
public partial class MyGeoPoint : IEmbeddedObject
{
[MapTo("coordinates")]
private IList<double> Coordinates { get; } = null!;
[MapTo("type")]
private string Type { get; set; } = "Point";
public double Latitude => Coordinates.Count > 1 ? Coordinates[1] : throw new Exception($"Invalid coordinate array. Expected at least 2 elements, but got: {Coordinates.Count}");
public double Longitude => Coordinates.Count > 1 ? Coordinates[0] : throw new Exception($"Invalid coordinate array. Expected at least 2 elements, but got: {Coordinates.Count}");
public MyGeoPoint(double latitude, double longitude)
{
Coordinates.Add(longitude);
Coordinates.Add(latitude);
}
}
Note that if you're using Sync, the name of the embedded object type must match exactly the title
of the embedded object defined in the GeoJson Schema on the server.
Performs a 'like' comparison between the specified string and pattern.
Declarationpublic static bool Like(string? str, string pattern, bool caseSensitive = true)
Parameters Type Name Description string str
The string to compare against the pattern.
string patternThe pattern to compare against.
bool caseSensitiveIf set to true
performs a case sensitive comparison.
true
if the string matches the pattern, false
otherwise.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4