Ascending index tests and Descending Index and tests
This commit is contained in:
@@ -1,29 +1,32 @@
|
||||
using MongoDbGenericRepository.DataAccess.Index;
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using System.Linq.Expressions;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using MongoDbGenericRepository.DataAccess.Index;
|
||||
using MongoDbGenericRepository.Models;
|
||||
|
||||
namespace MongoDbGenericRepository
|
||||
{
|
||||
/// <summary>
|
||||
/// The base Repository, it is meant to be inherited from by your custom custom MongoRepository implementation.
|
||||
/// Its constructor must be given a connection string and a database name.
|
||||
/// The base Repository, it is meant to be inherited from by your custom custom MongoRepository implementation.
|
||||
/// Its constructor must be given a connection string and a database name.
|
||||
/// </summary>
|
||||
public abstract partial class BaseMongoRepository : IBaseMongoRepository_Index
|
||||
{
|
||||
private IMongoDbIndexHandler _mongoDbIndexHandler;
|
||||
|
||||
/// <summary>
|
||||
/// The MongoDb accessor to manage indexes.
|
||||
/// The MongoDb accessor to manage indexes.
|
||||
/// </summary>
|
||||
protected virtual IMongoDbIndexHandler MongoDbIndexHandler
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_mongoDbIndexHandler != null) { return _mongoDbIndexHandler; }
|
||||
if (_mongoDbIndexHandler != null)
|
||||
{
|
||||
return _mongoDbIndexHandler;
|
||||
}
|
||||
|
||||
lock (_initLock)
|
||||
{
|
||||
@@ -32,9 +35,10 @@ namespace MongoDbGenericRepository
|
||||
_mongoDbIndexHandler = new MongoDbIndexHandler(MongoDbContext);
|
||||
}
|
||||
}
|
||||
|
||||
return _mongoDbIndexHandler;
|
||||
}
|
||||
set { _mongoDbIndexHandler = value; }
|
||||
set => _mongoDbIndexHandler = value;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
@@ -120,7 +124,10 @@ namespace MongoDbGenericRepository
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<string> CreateTextIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, string partitionKey, CancellationToken cancellationToken)
|
||||
public async Task<string> CreateTextIndexAsync<TDocument>(
|
||||
Expression<Func<TDocument, object>> field,
|
||||
string partitionKey,
|
||||
CancellationToken cancellationToken)
|
||||
where TDocument : IDocument<Guid>
|
||||
{
|
||||
return await CreateTextIndexAsync<TDocument, Guid>(field, null, partitionKey, cancellationToken);
|
||||
@@ -134,21 +141,31 @@ namespace MongoDbGenericRepository
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<string> CreateTextIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions, CancellationToken cancellationToken)
|
||||
public async Task<string> CreateTextIndexAsync<TDocument>(
|
||||
Expression<Func<TDocument, object>> field,
|
||||
IndexCreationOptions indexCreationOptions,
|
||||
CancellationToken cancellationToken)
|
||||
where TDocument : IDocument<Guid>
|
||||
{
|
||||
return await CreateTextIndexAsync<TDocument, Guid>(field, indexCreationOptions, null, cancellationToken);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<string> CreateTextIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions, string partitionKey)
|
||||
public async Task<string> CreateTextIndexAsync<TDocument>(
|
||||
Expression<Func<TDocument, object>> field,
|
||||
IndexCreationOptions indexCreationOptions,
|
||||
string partitionKey)
|
||||
where TDocument : IDocument<Guid>
|
||||
{
|
||||
return await CreateTextIndexAsync<TDocument, Guid>(field, indexCreationOptions, partitionKey, CancellationToken.None);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<string> CreateTextIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions, string partitionKey, CancellationToken cancellationToken)
|
||||
public async Task<string> CreateTextIndexAsync<TDocument>(
|
||||
Expression<Func<TDocument, object>> field,
|
||||
IndexCreationOptions indexCreationOptions,
|
||||
string partitionKey,
|
||||
CancellationToken cancellationToken)
|
||||
where TDocument : IDocument<Guid>
|
||||
{
|
||||
return await CreateTextIndexAsync<TDocument, Guid>(field, indexCreationOptions, partitionKey, cancellationToken);
|
||||
@@ -179,7 +196,10 @@ namespace MongoDbGenericRepository
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public virtual async Task<string> CreateTextIndexAsync<TDocument, TKey>(Expression<Func<TDocument, object>> field, string partitionKey, CancellationToken cancellationToken)
|
||||
public virtual async Task<string> CreateTextIndexAsync<TDocument, TKey>(
|
||||
Expression<Func<TDocument, object>> field,
|
||||
string partitionKey,
|
||||
CancellationToken cancellationToken)
|
||||
where TDocument : IDocument<TKey>
|
||||
where TKey : IEquatable<TKey>
|
||||
{
|
||||
@@ -187,7 +207,9 @@ namespace MongoDbGenericRepository
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public virtual async Task<string> CreateTextIndexAsync<TDocument, TKey>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions)
|
||||
public virtual async Task<string> CreateTextIndexAsync<TDocument, TKey>(
|
||||
Expression<Func<TDocument, object>> field,
|
||||
IndexCreationOptions indexCreationOptions)
|
||||
where TDocument : IDocument<TKey>
|
||||
where TKey : IEquatable<TKey>
|
||||
{
|
||||
@@ -195,7 +217,10 @@ namespace MongoDbGenericRepository
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public virtual async Task<string> CreateTextIndexAsync<TDocument, TKey>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions, CancellationToken cancellationToken)
|
||||
public virtual async Task<string> CreateTextIndexAsync<TDocument, TKey>(
|
||||
Expression<Func<TDocument, object>> field,
|
||||
IndexCreationOptions indexCreationOptions,
|
||||
CancellationToken cancellationToken)
|
||||
where TDocument : IDocument<TKey>
|
||||
where TKey : IEquatable<TKey>
|
||||
{
|
||||
@@ -203,7 +228,10 @@ namespace MongoDbGenericRepository
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public virtual async Task<string> CreateTextIndexAsync<TDocument, TKey>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions, string partitionKey)
|
||||
public virtual async Task<string> CreateTextIndexAsync<TDocument, TKey>(
|
||||
Expression<Func<TDocument, object>> field,
|
||||
IndexCreationOptions indexCreationOptions,
|
||||
string partitionKey)
|
||||
where TDocument : IDocument<TKey>
|
||||
where TKey : IEquatable<TKey>
|
||||
{
|
||||
@@ -211,7 +239,11 @@ namespace MongoDbGenericRepository
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public virtual async Task<string> CreateTextIndexAsync<TDocument, TKey>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions, string partitionKey, CancellationToken cancellationToken)
|
||||
public virtual async Task<string> CreateTextIndexAsync<TDocument, TKey>(
|
||||
Expression<Func<TDocument, object>> field,
|
||||
IndexCreationOptions indexCreationOptions,
|
||||
string partitionKey,
|
||||
CancellationToken cancellationToken)
|
||||
where TDocument : IDocument<TKey>
|
||||
where TKey : IEquatable<TKey>
|
||||
{
|
||||
@@ -219,44 +251,291 @@ namespace MongoDbGenericRepository
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<string> CreateAscendingIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions = null, string partitionKey = null)
|
||||
public async Task<string> CreateAscendingIndexAsync<TDocument>(Expression<Func<TDocument, object>> field)
|
||||
where TDocument : IDocument<Guid>
|
||||
{
|
||||
return await CreateAscendingIndexAsync<TDocument, Guid>(field, indexCreationOptions, partitionKey);
|
||||
return await CreateAscendingIndexAsync<TDocument, Guid>(field, null, null, CancellationToken.None);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public virtual async Task<string> CreateAscendingIndexAsync<TDocument, TKey>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions = null, string partitionKey = null)
|
||||
public async Task<string> CreateAscendingIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, CancellationToken cancellationToken)
|
||||
where TDocument : IDocument<Guid>
|
||||
{
|
||||
return await CreateAscendingIndexAsync<TDocument, Guid>(field, null, null, cancellationToken);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<string> CreateAscendingIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions)
|
||||
where TDocument : IDocument<Guid>
|
||||
{
|
||||
return await CreateAscendingIndexAsync<TDocument, Guid>(field, indexCreationOptions, null, CancellationToken.None);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<string> CreateAscendingIndexAsync<TDocument>(
|
||||
Expression<Func<TDocument, object>> field,
|
||||
IndexCreationOptions indexCreationOptions,
|
||||
CancellationToken cancellationToken)
|
||||
where TDocument : IDocument<Guid>
|
||||
{
|
||||
return await CreateAscendingIndexAsync<TDocument, Guid>(field, indexCreationOptions, null, cancellationToken);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<string> CreateAscendingIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, string partitionKey)
|
||||
where TDocument : IDocument<Guid>
|
||||
{
|
||||
return await CreateAscendingIndexAsync<TDocument, Guid>(field, null, partitionKey, CancellationToken.None);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<string> CreateAscendingIndexAsync<TDocument>(
|
||||
Expression<Func<TDocument, object>> field,
|
||||
string partitionKey,
|
||||
CancellationToken cancellationToken)
|
||||
where TDocument : IDocument<Guid>
|
||||
{
|
||||
return await CreateAscendingIndexAsync<TDocument, Guid>(field, null, partitionKey, cancellationToken);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<string> CreateAscendingIndexAsync<TDocument>(
|
||||
Expression<Func<TDocument, object>> field,
|
||||
IndexCreationOptions indexCreationOptions,
|
||||
string partitionKey)
|
||||
where TDocument : IDocument<Guid>
|
||||
{
|
||||
return await CreateAscendingIndexAsync<TDocument, Guid>(field, indexCreationOptions, partitionKey, CancellationToken.None);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<string> CreateAscendingIndexAsync<TDocument>(
|
||||
Expression<Func<TDocument, object>> field,
|
||||
IndexCreationOptions indexCreationOptions,
|
||||
string partitionKey,
|
||||
CancellationToken cancellationToken)
|
||||
where TDocument : IDocument<Guid>
|
||||
{
|
||||
return await CreateAscendingIndexAsync<TDocument, Guid>(field, indexCreationOptions, partitionKey, cancellationToken);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public virtual async Task<string> CreateAscendingIndexAsync<TDocument, TKey>(Expression<Func<TDocument, object>> field)
|
||||
where TDocument : IDocument<TKey>
|
||||
where TKey : IEquatable<TKey>
|
||||
{
|
||||
return await MongoDbIndexHandler.CreateAscendingIndexAsync<TDocument, TKey>(field, indexCreationOptions, partitionKey);
|
||||
return await CreateAscendingIndexAsync<TDocument, TKey>(field, null, null, CancellationToken.None);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<string> CreateDescendingIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions = null, string partitionKey = null)
|
||||
where TDocument : IDocument<Guid>
|
||||
{
|
||||
return await CreateDescendingIndexAsync<TDocument, Guid>(field, indexCreationOptions, partitionKey);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public virtual async Task<string> CreateDescendingIndexAsync<TDocument, TKey>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions = null, string partitionKey = null)
|
||||
public virtual async Task<string> CreateAscendingIndexAsync<TDocument, TKey>(
|
||||
Expression<Func<TDocument, object>> field,
|
||||
CancellationToken cancellationToken)
|
||||
where TDocument : IDocument<TKey>
|
||||
where TKey : IEquatable<TKey>
|
||||
{
|
||||
return await MongoDbIndexHandler.CreateDescendingIndexAsync<TDocument, TKey>(field, indexCreationOptions, partitionKey);
|
||||
return await CreateAscendingIndexAsync<TDocument, TKey>(field, null, null, cancellationToken);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<string> CreateHashedIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions = null, string partitionKey = null)
|
||||
public virtual async Task<string> CreateAscendingIndexAsync<TDocument, TKey>(
|
||||
Expression<Func<TDocument, object>> field,
|
||||
IndexCreationOptions indexCreationOptions)
|
||||
where TDocument : IDocument<TKey>
|
||||
where TKey : IEquatable<TKey>
|
||||
{
|
||||
return await CreateAscendingIndexAsync<TDocument, TKey>(field, indexCreationOptions, null, CancellationToken.None);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public virtual async Task<string> CreateAscendingIndexAsync<TDocument, TKey>(
|
||||
Expression<Func<TDocument, object>> field,
|
||||
IndexCreationOptions indexCreationOptions,
|
||||
CancellationToken cancellationToken)
|
||||
where TDocument : IDocument<TKey>
|
||||
where TKey : IEquatable<TKey>
|
||||
{
|
||||
return await CreateAscendingIndexAsync<TDocument, TKey>(field, indexCreationOptions, null, cancellationToken);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public virtual async Task<string> CreateAscendingIndexAsync<TDocument, TKey>(Expression<Func<TDocument, object>> field, string partitionKey)
|
||||
where TDocument : IDocument<TKey>
|
||||
where TKey : IEquatable<TKey>
|
||||
{
|
||||
return await CreateAscendingIndexAsync<TDocument, TKey>(field, null, partitionKey, CancellationToken.None);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public virtual async Task<string> CreateAscendingIndexAsync<TDocument, TKey>(
|
||||
Expression<Func<TDocument, object>> field,
|
||||
string partitionKey,
|
||||
CancellationToken cancellationToken)
|
||||
where TDocument : IDocument<TKey>
|
||||
where TKey : IEquatable<TKey>
|
||||
{
|
||||
return await CreateAscendingIndexAsync<TDocument, TKey>(field, null, partitionKey, cancellationToken);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public virtual async Task<string> CreateAscendingIndexAsync<TDocument, TKey>(
|
||||
Expression<Func<TDocument, object>> field,
|
||||
IndexCreationOptions indexCreationOptions,
|
||||
string partitionKey)
|
||||
where TDocument : IDocument<TKey>
|
||||
where TKey : IEquatable<TKey>
|
||||
{
|
||||
return await CreateAscendingIndexAsync<TDocument, TKey>(field, indexCreationOptions, partitionKey, CancellationToken.None);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public virtual async Task<string> CreateAscendingIndexAsync<TDocument, TKey>(
|
||||
Expression<Func<TDocument, object>> field,
|
||||
IndexCreationOptions indexCreationOptions,
|
||||
string partitionKey,
|
||||
CancellationToken cancellationToken)
|
||||
where TDocument : IDocument<TKey>
|
||||
where TKey : IEquatable<TKey>
|
||||
{
|
||||
return await MongoDbIndexHandler.CreateAscendingIndexAsync<TDocument, TKey>(field, indexCreationOptions, partitionKey, cancellationToken);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<string> CreateDescendingIndexAsync<TDocument>(Expression<Func<TDocument, object>> field)
|
||||
where TDocument : IDocument<Guid>
|
||||
{
|
||||
return await CreateDescendingIndexAsync<TDocument, Guid>(field, null, null, CancellationToken.None);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<string> CreateDescendingIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, CancellationToken cancellationToken)
|
||||
where TDocument : IDocument<Guid>
|
||||
{
|
||||
return await CreateDescendingIndexAsync<TDocument, Guid>(field, null, null, cancellationToken);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<string> CreateDescendingIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions)
|
||||
where TDocument : IDocument<Guid>
|
||||
{
|
||||
return await CreateDescendingIndexAsync<TDocument, Guid>(field, indexCreationOptions, null, CancellationToken.None);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<string> CreateDescendingIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions, CancellationToken cancellationToken)
|
||||
where TDocument : IDocument<Guid>
|
||||
{
|
||||
return await CreateDescendingIndexAsync<TDocument, Guid>(field, indexCreationOptions, null, cancellationToken);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<string> CreateDescendingIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, string partitionKey)
|
||||
where TDocument : IDocument<Guid>
|
||||
{
|
||||
return await CreateDescendingIndexAsync<TDocument, Guid>(field, null, partitionKey, CancellationToken.None);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<string> CreateDescendingIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, string partitionKey, CancellationToken cancellationToken)
|
||||
where TDocument : IDocument<Guid>
|
||||
{
|
||||
return await CreateDescendingIndexAsync<TDocument, Guid>(field, null, partitionKey, cancellationToken);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<string> CreateDescendingIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions, string partitionKey)
|
||||
where TDocument : IDocument<Guid>
|
||||
{
|
||||
return await CreateDescendingIndexAsync<TDocument, Guid>(field, indexCreationOptions, partitionKey, CancellationToken.None);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<string> CreateDescendingIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions, string partitionKey, CancellationToken cancellationToken)
|
||||
where TDocument : IDocument<Guid>
|
||||
{
|
||||
return await CreateDescendingIndexAsync<TDocument, Guid>(field, indexCreationOptions, partitionKey, cancellationToken);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public virtual async Task<string> CreateDescendingIndexAsync<TDocument, TKey>(Expression<Func<TDocument, object>> field)
|
||||
where TDocument : IDocument<TKey>
|
||||
where TKey : IEquatable<TKey>
|
||||
{
|
||||
return await CreateDescendingIndexAsync<TDocument, TKey>(field, null, null, CancellationToken.None);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public virtual async Task<string> CreateDescendingIndexAsync<TDocument, TKey>(Expression<Func<TDocument, object>> field, CancellationToken cancellationToken)
|
||||
where TDocument : IDocument<TKey>
|
||||
where TKey : IEquatable<TKey>
|
||||
{
|
||||
return await CreateDescendingIndexAsync<TDocument, TKey>(field, null, null, cancellationToken);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public virtual async Task<string> CreateDescendingIndexAsync<TDocument, TKey>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions)
|
||||
where TDocument : IDocument<TKey>
|
||||
where TKey : IEquatable<TKey>
|
||||
{
|
||||
return await CreateDescendingIndexAsync<TDocument, TKey>(field, indexCreationOptions, null, CancellationToken.None);
|
||||
}
|
||||
|
||||
|
||||
/// <inheritdoc />
|
||||
public virtual async Task<string> CreateDescendingIndexAsync<TDocument, TKey>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions, CancellationToken cancellationToken)
|
||||
where TDocument : IDocument<TKey>
|
||||
where TKey : IEquatable<TKey>
|
||||
{
|
||||
return await CreateDescendingIndexAsync<TDocument, TKey>(field, indexCreationOptions, null, cancellationToken);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public virtual async Task<string> CreateDescendingIndexAsync<TDocument, TKey>(Expression<Func<TDocument, object>> field, string partitionKey)
|
||||
where TDocument : IDocument<TKey>
|
||||
where TKey : IEquatable<TKey>
|
||||
{
|
||||
return await CreateDescendingIndexAsync<TDocument, TKey>(field, null, partitionKey, CancellationToken.None);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public virtual async Task<string> CreateDescendingIndexAsync<TDocument, TKey>(Expression<Func<TDocument, object>> field, string partitionKey, CancellationToken cancellationToken)
|
||||
where TDocument : IDocument<TKey>
|
||||
where TKey : IEquatable<TKey>
|
||||
{
|
||||
return await CreateDescendingIndexAsync<TDocument, TKey>(field, null, partitionKey, cancellationToken);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public virtual async Task<string> CreateDescendingIndexAsync<TDocument, TKey>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions, string partitionKey)
|
||||
where TDocument : IDocument<TKey>
|
||||
where TKey : IEquatable<TKey>
|
||||
{
|
||||
return await CreateDescendingIndexAsync<TDocument, TKey>(field, indexCreationOptions, partitionKey, CancellationToken.None);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public virtual async Task<string> CreateDescendingIndexAsync<TDocument, TKey>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions, string partitionKey, CancellationToken cancellationToken)
|
||||
where TDocument : IDocument<TKey>
|
||||
where TKey : IEquatable<TKey>
|
||||
{
|
||||
return await MongoDbIndexHandler.CreateDescendingIndexAsync<TDocument, TKey>(field, indexCreationOptions, partitionKey, cancellationToken);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<string> CreateHashedIndexAsync<TDocument>(
|
||||
Expression<Func<TDocument, object>> field,
|
||||
IndexCreationOptions indexCreationOptions = null,
|
||||
string partitionKey = null)
|
||||
where TDocument : IDocument<Guid>
|
||||
{
|
||||
return await CreateHashedIndexAsync<TDocument, Guid>(field, indexCreationOptions, partitionKey);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public virtual async Task<string> CreateHashedIndexAsync<TDocument, TKey>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions = null, string partitionKey = null)
|
||||
public virtual async Task<string> CreateHashedIndexAsync<TDocument, TKey>(
|
||||
Expression<Func<TDocument, object>> field,
|
||||
IndexCreationOptions indexCreationOptions = null,
|
||||
string partitionKey = null)
|
||||
where TDocument : IDocument<TKey>
|
||||
where TKey : IEquatable<TKey>
|
||||
{
|
||||
@@ -264,14 +543,20 @@ namespace MongoDbGenericRepository
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<string> CreateCombinedTextIndexAsync<TDocument>(IEnumerable<Expression<Func<TDocument, object>>> fields, IndexCreationOptions indexCreationOptions = null, string partitionKey = null)
|
||||
public async Task<string> CreateCombinedTextIndexAsync<TDocument>(
|
||||
IEnumerable<Expression<Func<TDocument, object>>> fields,
|
||||
IndexCreationOptions indexCreationOptions = null,
|
||||
string partitionKey = null)
|
||||
where TDocument : IDocument<Guid>
|
||||
{
|
||||
return await CreateCombinedTextIndexAsync<TDocument, Guid>(fields, indexCreationOptions, partitionKey);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public virtual async Task<string> CreateCombinedTextIndexAsync<TDocument, TKey>(IEnumerable<Expression<Func<TDocument, object>>> fields, IndexCreationOptions indexCreationOptions = null, string partitionKey = null)
|
||||
public virtual async Task<string> CreateCombinedTextIndexAsync<TDocument, TKey>(
|
||||
IEnumerable<Expression<Func<TDocument, object>>> fields,
|
||||
IndexCreationOptions indexCreationOptions = null,
|
||||
string partitionKey = null)
|
||||
where TDocument : IDocument<TKey>
|
||||
where TKey : IEquatable<TKey>
|
||||
{
|
||||
@@ -293,4 +578,4 @@ namespace MongoDbGenericRepository
|
||||
await MongoDbIndexHandler.DropIndexAsync<TDocument, TKey>(indexName, partitionKey);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user