Fauna v10 .NET/C# Driver 1.0.1
 
Loading...
Searching...
No Matches
Classes | Public Member Functions | Protected Member Functions | Properties | List of all members
Fauna.Linq.DataContext.Collection< Doc > Class Template Referenceabstract

An abstract collection. This should be implemented for each collection in the database. More...

Inheritance diagram for Fauna.Linq.DataContext.Collection< Doc >:
Fauna.Linq.QuerySource< Doc > Fauna.Linq.DataContext.ICollection Fauna.Linq.IQuerySource< T > Fauna.Linq.IQuerySource< T >

Classes

class  IndexCall
 A class representing an index call. More...
 

Public Member Functions

 Collection ()
 Initializes a new collection with a name set to the NameAttribute, or the name of .NET type associated with its documents.
 
- Public Member Functions inherited from Fauna.Linq.QuerySource< Doc >
IAsyncEnumerable< Page< T > > PaginateAsync (QueryOptions? queryOptions=null, CancellationToken cancel=default)
 Executes a query with pagination.
 
IAsyncEnumerable< T > ToAsyncEnumerable (CancellationToken cancel=default)
 Executes a query asynchronously.
 
IEnumerable< T > ToEnumerable ()
 Executes a query.
 
IQuerySource< T > Distinct ()
 Obtains a distinct set of results. This is evaluated server-side.
Returns
This IQuerySource<T> instance.

 
IQuerySource< T > Order ()
 Applies default ordering to the query. This is evaluated server-side.
Returns
This IQuerySource<T> instance.

 
IQuerySource< T > OrderBy< K > (Expression< Func< T, K > > keySelector)
 Orders according to the selector. This is evaluated server-side.
Returns
This IQuerySource<T> instance.

 
IQuerySource< T > OrderByDescending< K > (Expression< Func< T, K > > keySelector)
 Orders by descending according to the selector. This is evaluated server-side.
Returns
This IQuerySource<T> instance.

 
IQuerySource< T > OrderDescending ()
 Orders by descending. This is evaluated server-side.
Returns
This IQuerySource<T> instance.

 
IQuerySource< T > Reverse ()
 Reverses the order of the results. This is evaluated server-side.
Returns
This IQuerySource<T> instance.

 
IQuerySource< R > Select< R > (Expression< Func< T, R > > selector)
 Applies a projection to the query. This is evaluated server-side.
Returns
This IQuerySource<T> instance.

 
IQuerySource< T > Skip (int count)
 Skips the first N elements of the results. This is evaluated server-side.
Returns
This IQuerySource<T> instance.

 
IQuerySource< T > Take (int count)
 Takes the first N elements of the results. This is evaluated server-side.
Returns
This IQuerySource<T> instance.

 
IQuerySource< T > Where (Expression< Func< T, bool > > predicate)
 Applies the predicate to the query. This is evaluated server-side.
Returns
This IQuerySource<T> instance.

 
bool All (Expression< Func< T, bool > > predicate)
 Applies each predicate and executes the query. This is evaluated server-side.
Returns
True if every predicate evaluates to true. Otherwise, false.

 
Task< bool > AllAsync (Expression< Func< T, bool > > predicate, CancellationToken cancel=default)
 Applies each predicate and executes the query asynchronously. This is evaluated server-side.
Returns
True if every predicate evaluate to true, otherwise false.

 
bool Any ()
 Determines if the result is not empty. This is evaluated server-side.
Returns
True if the result contains any elements, otherwise false.

 
bool Any (Expression< Func< T, bool > > predicate)
 Applies each predicate and executes the query. This is evaluated server-side.
Returns
True if any predicate evaluates to true, otherwise false.

 
Task< bool > AnyAsync (CancellationToken cancel=default)
 Determines if the result is not empty asynchronously. This is evaluated server-side.
Returns
True if the result contains any elements, otherwise false.

 
Task< bool > AnyAsync (Expression< Func< T, bool > > predicate, CancellationToken cancel=default)
 Applies each predicate and executes the query asynchronously. This is evaluated server-side.
Returns
True if any predicate evaluates to true, otherwise false.

 
int Count ()
 Applies a count of the elements and executes the query. This is evaluated server-side.
Returns
The number of elements in the result.

 
int Count (Expression< Func< T, bool > > predicate)
 Applies the predicate, applies a count, and executes the query. This is evaluated server-side.
Returns
The number of elements in the result.

 
Task< int > CountAsync (CancellationToken cancel=default)
 Applies a count of the elements and executes the query asynchronously. This is evaluated server-side.
Returns
The number of elements in the result.

 
Task< int > CountAsync (Expression< Func< T, bool > > predicate, CancellationToken cancel=default)
 Applies the predicate, applies a count, and executes the query asynchronously. This is evaluated server-side.
Returns
The number of elements in the result.

 
First ()
 Executes the query and obtains the first element in the result. This is evaluated server-side.
Returns
The first element in the result.

 
First (Expression< Func< T, bool > > predicate)
 Applies the predicate, executes the query, and obtains the first element in the result. This is evaluated server-side.
Returns
The first element in the result.

 
Task< T > FirstAsync (CancellationToken cancel=default)
 Executes the query asynchronously and obtains the first element in the result. This is evaluated server-side.
Returns
The first element in the result.

 
Task< T > FirstAsync (Expression< Func< T, bool > > predicate, CancellationToken cancel=default)
 Applies the predicate, executes the query asynchronously, and obtains the first element in the result. This is evaluated server-side.
Returns
The first element in the result.

 
T? FirstOrDefault ()
 Executes the query and obtains the first element in the result or the default value, if there is no result. This is evaluated server-side.
Returns
The first element in the result or the default value, if there is no result.

 
T? FirstOrDefault (Expression< Func< T, bool > > predicate)
 Applies the predicate, executes the query, and obtains the first element in the result or the default value, if there is no result. This is evaluated server-side.
Returns
The first element in the result.

 
Task< T?> FirstOrDefaultAsync (CancellationToken cancel=default)
 Executes the query asynchronously and obtains the first element in the result or the default value, if there is no result. This is evaluated server-side.
Returns
The first element in the result.

 
Task< T?> FirstOrDefaultAsync (Expression< Func< T, bool > > predicate, CancellationToken cancel=default)
 Applies the predicate, executes the query asynchronously, and obtains the first element in the result or the default value, if there is no result. This is evaluated server-side.
Returns
The first element in the result.

 
Last ()
 Executes the query and obtains the last element in the result. This is evaluated server-side.
Returns
The last element in the result.

 
Last (Expression< Func< T, bool > > predicate)
 Applies the predicate, executes the query, and obtains the last element in the result. This is evaluated server-side.
Returns
The last element in the result.

 
Task< T > LastAsync (CancellationToken cancel=default)
 Executes the query asynchronously and obtains the last element in the result. This is evaluated server-side.
Returns
The last element in the result.

 
Task< T > LastAsync (Expression< Func< T, bool > > predicate, CancellationToken cancel=default)
 Applies the predicate, executes the query asynchronously, and obtains the last element in the result. This is evaluated server-side.
Returns
The last element in the result.

 
T? LastOrDefault ()
 Executes the query and obtains the last element in the result or the default value, if there is no result. This is evaluated server-side.
Returns
The last element in the result or the default value, if there is no result.

 
T? LastOrDefault (Expression< Func< T, bool > > predicate)
 Applies the predicate, executes the query and obtains the last element in the result or the default value, if there is no result. This is evaluated server-side.
Returns
The last element in the result or the default value, if there is no result.

 
Task< T?> LastOrDefaultAsync (CancellationToken cancel=default)
 Executes the query asynchronously and obtains the last element in the result or the default value, if there is no result. This is evaluated server-side.
Returns
The last element in the result or the default value, if there is no result.

 
Task< T?> LastOrDefaultAsync (Expression< Func< T, bool > > predicate, CancellationToken cancel=default)
 Applies the predicate, executes the query asynchronously and obtains the last element in the result or the default value, if there is no result. This is evaluated server-side.
Returns
The last element in the result or the default value, if there is no result.

 
long LongCount ()
 Applies a count of the elements and executes the query. This is evaluated server-side.
Returns
The number of elements in the result.

 
long LongCount (Expression< Func< T, bool > > predicate)
 Applies the predicate, applies a count, and executes the query. This is evaluated server-side.
Returns
The number of elements in the result.

 
Task< long > LongCountAsync (CancellationToken cancel=default)
 Applies a count of the elements and executes the query asynchronously. This is evaluated server-side.
Returns
The number of elements in the result.

 
Task< long > LongCountAsync (Expression< Func< T, bool > > predicate, CancellationToken cancel=default)
 Applies the predicate, applies a count, and executes the query asynchronously. This is evaluated server-side.
Returns
The number of elements in the result.

 
Max ()
 Executes a query and returns the maximum value in the result set. This is evaluated server-side. (a, b) => if (a >= b) a else b.
Returns
The maximum T .

 
Task< T > MaxAsync (CancellationToken cancel=default)
 Executes a query asynchronously and returns the maximum value in the result set. This is evaluated server-side. (a, b) => if (a >= b) a else b.
Returns
The maximum T .

 
Max< R > (Expression< Func< T, R > > selector)
 Applies a selector, executes a query, and returns the maximum value in the result set. This is evaluated server-side. (a, b) => if (a >= b) a else b.
Returns
The maximum T .

 
Task< R > MaxAsync< R > (Expression< Func< T, R > > selector, CancellationToken cancel=default)
 Applies a selector, executes a query asynchronously, and returns the maximum value in the result set. This is evaluated server-side. (a, b) => if (a >= b) a else b.
Returns
The maximum T .

 
Min ()
 Executes a query and returns the minimum value in the result set. This is evaluated server-side. (a, b) => if (a <= b) a else b.
Returns
The minimum T .

 
Task< T > MinAsync (CancellationToken cancel=default)
 Executes a query asynchronously and returns the minimum value in the result set. This is evaluated server-side. (a, b) => if (a <= b) a else b.
Returns
The minimum T .

 
Min< R > (Expression< Func< T, R > > selector)
 Applies the selector, executes the query, and returns the minimum value in the result set. This is evaluated server-side. (a, b) => if (a <= b) a else b.
Returns
The minimum T .

 
Task< R > MinAsync< R > (Expression< Func< T, R > > selector, CancellationToken cancel=default)
 Applies the selector, executes the query asynchronously, and returns the minimum value in the result set. This is evaluated server-side. (a, b) => if (a <= b) a else b.
Returns
The minimum T .

 
double Average (Expression< Func< T, double > > selector)
 Calculates the mean average of values returned by a provided selector. This is evaluated server-side.
Returns
The mean average of selected values.

 
Task< double > AverageAsync (Expression< Func< T, double > > selector, CancellationToken cancel=default)
 Asynchronously calculates the mean average of values returned by a provided selector. This is evaluated server-side.
Returns
The mean average of selected values.

 
Single ()
 Executes the query. If the result is a single element, returns it. Otherwise, throws an exception. This is evaluated server-side.
Returns
The query result.

 
Single (Expression< Func< T, bool > > predicate)
 Applies the predicate and executes the query. If the result is a single element, returns it. Otherwise, throws an exception. This is evaluated server-side.
Returns
The query result.

 
Task< T > SingleAsync (CancellationToken cancel=default)
 Executes the query asynchronously. If the result is a single element, returns it. Otherwise, throws an exception. This is evaluated server-side.
Returns
The query result.

 
Task< T > SingleAsync (Expression< Func< T, bool > > predicate, CancellationToken cancel=default)
 Applies the predicate and executes the query asynchronously. If the result is a single element, returns it. Otherwise, throws an exception. This is evaluated server-side.
Returns
The query result.

 
SingleOrDefault ()
 Executes the query. If the result is a single element, returns it. Otherwise, returns the default. This is evaluated server-side.
Returns
The query result or default.

 
SingleOrDefault (Expression< Func< T, bool > > predicate)
 Applies the predicate and executes the query. If the result is a single element, returns it. Otherwise, returns the default. This is evaluated server-side.
Returns
The query result or default.

 
Task< T > SingleOrDefaultAsync (CancellationToken cancel=default)
 Executes the query asynchronously. If the result is a single element, returns it. Otherwise, returns the default. This is evaluated server-side.
Returns
The query result or default.

 
Task< T > SingleOrDefaultAsync (Expression< Func< T, bool > > predicate, CancellationToken cancel=default)
 Applies the predicate and executes the query asynchronously. If the result is a single element, returns it. Otherwise, returns the default. This is evaluated server-side.
Returns
The query result or default.

 
int Sum (Expression< Func< T, int > > selector)
 Calculates the sum of values returned by a provided selector. This is evaluated server-side.
Returns
The sum of selected values.

 
long Sum (Expression< Func< T, long > > selector)
 Calculates the sum of values returned by a provided selector. This is evaluated server-side.
Returns
The sum of selected values.

 
double Sum (Expression< Func< T, double > > selector)
 Calculates the sum of values returned by a provided selector. This is evaluated server-side.
Returns
The sum of selected values.

 
Task< int > SumAsync (Expression< Func< T, int > > selector, CancellationToken cancel=default)
 Asynchronously calculates the sum of values returned by a provided selector. This is evaluated server-side.
Returns
The sum of selected values.

 
Task< long > SumAsync (Expression< Func< T, long > > selector, CancellationToken cancel=default)
 Asynchronously calculates the sum of values returned by a provided selector. This is evaluated server-side.
Returns
The sum of selected values.

 
Task< double > SumAsync (Expression< Func< T, double > > selector, CancellationToken cancel=default)
 Asynchronously calculates the sum of values returned by a provided selector. This is evaluated server-side.
Returns
The sum of selected values.

 
List< T > ToList ()
 Executes the query synchronously and converts the results to a List<T>.
 
async Task< List< T > > ToListAsync (CancellationToken cancel=default)
 Executes the query asynchronously and converts the results to a List<T>.
 
T[] ToArray ()
 Executes the query synchronously and converts the results to a T:T[].
 
async Task< T[]> ToArrayAsync (CancellationToken cancel=default)
 Executes the query asynchronously and converts the results to a T:T[].
 
HashSet< T > ToHashSet ()
 Executes the query synchronously and converts the results to a HashSet<T>.
 
HashSet< T > ToHashSet (IEqualityComparer< T >? comparer)
 Executes the query synchronously and converts the results to a HashSet<T> using a comparer.
 
Task< HashSet< T > > ToHashSetAsync (CancellationToken cancel=default)
 Executes the query asynchronously and converts the results to a HashSet<T>.
 
async Task< HashSet< T > > ToHashSetAsync (IEqualityComparer< T >? comparer, CancellationToken cancel=default)
 Executes the query asynchronously and converts the results to a HashSet<T>.
 
Dictionary< K, V > ToDictionary< K, V > (Func< T, K > getKey, Func< T, V > getValue)
 Executes the query synchronously and converts the results to a Dictionary<K,V>.
 
Dictionary< K, V > ToDictionary< K, V > (Func< T, K > getKey, Func< T, V > getValue, IEqualityComparer< K >? comparer)
 Executes the query synchronously and converts the results to a Dictionary<K,V>.
 
Task< Dictionary< K, V > > ToDictionaryAsync< K, V > (Func< T, K > getKey, Func< T, V > getValue, CancellationToken cancel=default)
 Executes the query asynchronously and converts the results to a Dictionary<K,V>.
 
async Task< Dictionary< K, V > > ToDictionaryAsync< K, V > (Func< T, K > getKey, Func< T, V > getValue, IEqualityComparer< K >? comparer, CancellationToken cancel=default)
 Executes the query asynchronously and converts the results to a Dictionary<K,V>.
 
- Public Member Functions inherited from Fauna.Linq.IQuerySource< T >
IAsyncEnumerable< Page< T > > PaginateAsync (QueryOptions? queryOptions=null, CancellationToken cancel=default)
 Executes a paginating query asynchronously and returns an enumerable of pages.
 

Protected Member Functions

IndexCall Index (string? name=null, [CallerMemberName] string? auto=null)
 Initializes an index associated with the collection. The name of the index can be assigned, or if declared inside a concrete DataContext, a canonical name will be assigned when a name is not provided.
 

Properties

string Name [get]
 The collection name.
 
Type DocType [get]
 The .NET type associated with documents in the collection.
 
- Properties inherited from Fauna.Linq.DataContext.ICollection

Detailed Description

An abstract collection. This should be implemented for each collection in the database.

Template Parameters
DocThe .NET type associated with documents in the collection.

Definition at line 114 of file DataContext.cs.

Constructor & Destructor Documentation

◆ Collection()

Initializes a new collection with a name set to the NameAttribute, or the name of .NET type associated with its documents.

Definition at line 126 of file DataContext.cs.

Member Function Documentation

◆ Index()

IndexCall Fauna.Linq.DataContext.Collection< Doc >.Index ( string?  name = null,
[CallerMemberName] string?  auto = null 
)
protected

Initializes an index associated with the collection. The name of the index can be assigned, or if declared inside a concrete DataContext, a canonical name will be assigned when a name is not provided.

Parameters
nameThe name of the index.
autoUsed to generate a canonical name when name is null.
Returns
Exceptions
ArgumentException

Definition at line 144 of file DataContext.cs.

Property Documentation

◆ DocType

Type Fauna.Linq.DataContext.Collection< Doc >.DocType
get

The .NET type associated with documents in the collection.

Implements Fauna.Linq.DataContext.ICollection.

Definition at line 120 of file DataContext.cs.

◆ Name

string Fauna.Linq.DataContext.Collection< Doc >.Name
get

The collection name.

Implements Fauna.Linq.DataContext.ICollection.

Definition at line 117 of file DataContext.cs.


The documentation for this class was generated from the following file: