Ascending index tests and Descending Index and tests
This commit is contained in:
@@ -0,0 +1,294 @@
|
||||
using System;
|
||||
using System.Linq.Expressions;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using AutoFixture;
|
||||
using CoreUnitTests.Infrastructure.Model;
|
||||
using MongoDbGenericRepository.DataAccess.Index;
|
||||
using MongoDbGenericRepository.Models;
|
||||
using Moq;
|
||||
using Xunit;
|
||||
|
||||
namespace CoreUnitTests.BaseMongoRepositoryTests.IndexTests;
|
||||
|
||||
public class CreateAscendingIndexAsyncTests : BaseIndexTests
|
||||
{
|
||||
private readonly Expression<Func<TestDocumentWithKey<int>, object>> keyedFieldExpression = t => t.SomeContent2;
|
||||
private readonly Expression<Func<TestDocument, object>> fieldExpression = t => t.SomeContent2;
|
||||
|
||||
[Fact]
|
||||
public async Task WithFieldExpression_CreatesIndex()
|
||||
{
|
||||
// Arrange
|
||||
IndexHandler = new Mock<IMongoDbIndexHandler>();
|
||||
|
||||
// Act
|
||||
await Sut.CreateAscendingIndexAsync(fieldExpression);
|
||||
|
||||
// Assert
|
||||
IndexHandler.Verify(
|
||||
x => x.CreateAscendingIndexAsync<TestDocument, Guid>(fieldExpression, null, null, CancellationToken.None));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task WithFieldExpressionAndCancellationToken_CreatesIndex()
|
||||
{
|
||||
// Arrange
|
||||
var token = new CancellationToken(true);
|
||||
IndexHandler = new Mock<IMongoDbIndexHandler>();
|
||||
|
||||
// Act
|
||||
await Sut.CreateAscendingIndexAsync(fieldExpression, token);
|
||||
|
||||
// Assert
|
||||
IndexHandler.Verify(
|
||||
x => x.CreateAscendingIndexAsync<TestDocument, Guid>(fieldExpression, null, null, token));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task WithFieldExpressionAndOptions_CreatesIndex()
|
||||
{
|
||||
// Arrange
|
||||
var indexName = Fixture.Create<string>();
|
||||
var options = new IndexCreationOptions { Name = indexName };
|
||||
IndexHandler = new Mock<IMongoDbIndexHandler>();
|
||||
|
||||
// Act
|
||||
await Sut.CreateAscendingIndexAsync(fieldExpression, options);
|
||||
|
||||
// Assert
|
||||
IndexHandler.Verify(
|
||||
x => x.CreateAscendingIndexAsync<TestDocument, Guid>(
|
||||
fieldExpression, options, null, CancellationToken.None));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task WithFieldExpressionAndOptionsAndCancellationToken_CreatesIndex()
|
||||
{
|
||||
// Arrange
|
||||
var indexName = Fixture.Create<string>();
|
||||
var options = new IndexCreationOptions { Name = indexName };
|
||||
var token = new CancellationToken(true);
|
||||
IndexHandler = new Mock<IMongoDbIndexHandler>();
|
||||
|
||||
// Act
|
||||
await Sut.CreateAscendingIndexAsync(fieldExpression, options, token);
|
||||
|
||||
// Assert
|
||||
IndexHandler.Verify(
|
||||
x => x.CreateAscendingIndexAsync<TestDocument, Guid>(
|
||||
fieldExpression, options, null, token));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task WithFieldExpressionAndPartitionKey_CreatesIndex()
|
||||
{
|
||||
// Arrange
|
||||
var partitionKey = Fixture.Create<string>();
|
||||
IndexHandler = new Mock<IMongoDbIndexHandler>();
|
||||
|
||||
// Act
|
||||
await Sut.CreateAscendingIndexAsync(fieldExpression, partitionKey);
|
||||
|
||||
// Assert
|
||||
IndexHandler.Verify(
|
||||
x => x.CreateAscendingIndexAsync<TestDocument, Guid>(
|
||||
fieldExpression, null, partitionKey, CancellationToken.None));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task WithFieldExpressionAndPartitionKeyAndCancellationToken_CreatesIndex()
|
||||
{
|
||||
// Arrange
|
||||
var partitionKey = Fixture.Create<string>();
|
||||
var token = new CancellationToken(true);
|
||||
IndexHandler = new Mock<IMongoDbIndexHandler>();
|
||||
|
||||
// Act
|
||||
await Sut.CreateAscendingIndexAsync(fieldExpression, partitionKey, token);
|
||||
|
||||
// Assert
|
||||
IndexHandler.Verify(
|
||||
x => x.CreateAscendingIndexAsync<TestDocument, Guid>(
|
||||
fieldExpression, null, partitionKey, token));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task WithFieldExpressionAndOptionsAndPartitionKey_CreatesIndex()
|
||||
{
|
||||
// Arrange
|
||||
var partitionKey = Fixture.Create<string>();
|
||||
var indexName = Fixture.Create<string>();
|
||||
var options = new IndexCreationOptions { Name = indexName };
|
||||
|
||||
IndexHandler = new Mock<IMongoDbIndexHandler>();
|
||||
|
||||
// Act
|
||||
await Sut.CreateAscendingIndexAsync(fieldExpression, options, partitionKey);
|
||||
|
||||
// Assert
|
||||
IndexHandler.Verify(
|
||||
x => x.CreateAscendingIndexAsync<TestDocument, Guid>(
|
||||
fieldExpression, options, partitionKey, CancellationToken.None));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task WithFieldExpressionAndOptionsAndPartitionKeyAndCancellationToken_CreatesIndex()
|
||||
{
|
||||
// Arrange
|
||||
var partitionKey = Fixture.Create<string>();
|
||||
var token = new CancellationToken(true);
|
||||
var indexName = Fixture.Create<string>();
|
||||
var options = new IndexCreationOptions { Name = indexName };
|
||||
|
||||
IndexHandler = new Mock<IMongoDbIndexHandler>();
|
||||
|
||||
// Act
|
||||
await Sut.CreateAscendingIndexAsync(fieldExpression, options, partitionKey, token);
|
||||
|
||||
// Assert
|
||||
IndexHandler.Verify(
|
||||
x => x.CreateAscendingIndexAsync<TestDocument, Guid>(
|
||||
fieldExpression, options, partitionKey, token));
|
||||
}
|
||||
|
||||
#region Keyed
|
||||
|
||||
[Fact]
|
||||
public async Task Keyed_WithFieldExpression_CreatesIndex()
|
||||
{
|
||||
// Arrange
|
||||
IndexHandler = new Mock<IMongoDbIndexHandler>();
|
||||
|
||||
// Act
|
||||
await Sut.CreateAscendingIndexAsync<TestDocumentWithKey<int>, int>(keyedFieldExpression);
|
||||
|
||||
// Assert
|
||||
IndexHandler.Verify(
|
||||
x => x.CreateAscendingIndexAsync<TestDocumentWithKey<int>, int>(keyedFieldExpression, null, null, CancellationToken.None));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Keyed_WithFieldExpressionAndCancellationToken_CreatesIndex()
|
||||
{
|
||||
// Arrange
|
||||
var token = new CancellationToken(true);
|
||||
IndexHandler = new Mock<IMongoDbIndexHandler>();
|
||||
|
||||
// Act
|
||||
await Sut.CreateAscendingIndexAsync<TestDocumentWithKey<int>, int>(keyedFieldExpression, token);
|
||||
|
||||
// Assert
|
||||
IndexHandler.Verify(
|
||||
x => x.CreateAscendingIndexAsync<TestDocumentWithKey<int>, int>(keyedFieldExpression, null, null, token));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Keyed_WithFieldExpressionAndOptions_CreatesIndex()
|
||||
{
|
||||
// Arrange
|
||||
var indexName = Fixture.Create<string>();
|
||||
var options = new IndexCreationOptions { Name = indexName };
|
||||
IndexHandler = new Mock<IMongoDbIndexHandler>();
|
||||
|
||||
// Act
|
||||
await Sut.CreateAscendingIndexAsync<TestDocumentWithKey<int>, int>(keyedFieldExpression, options);
|
||||
|
||||
// Assert
|
||||
IndexHandler.Verify(
|
||||
x => x.CreateAscendingIndexAsync<TestDocumentWithKey<int>, int>(
|
||||
keyedFieldExpression, options, null, CancellationToken.None));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Keyed_WithFieldExpressionAndOptionsAndCancellationToken_CreatesIndex()
|
||||
{
|
||||
// Arrange
|
||||
var indexName = Fixture.Create<string>();
|
||||
var options = new IndexCreationOptions { Name = indexName };
|
||||
var token = new CancellationToken(true);
|
||||
IndexHandler = new Mock<IMongoDbIndexHandler>();
|
||||
|
||||
// Act
|
||||
await Sut.CreateAscendingIndexAsync<TestDocumentWithKey<int>, int>(keyedFieldExpression, options, token);
|
||||
|
||||
// Assert
|
||||
IndexHandler.Verify(
|
||||
x => x.CreateAscendingIndexAsync<TestDocumentWithKey<int>, int>(
|
||||
keyedFieldExpression, options, null, token));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Keyed_WithFieldExpressionAndPartitionKey_CreatesIndex()
|
||||
{
|
||||
// Arrange
|
||||
var partitionKey = Fixture.Create<string>();
|
||||
IndexHandler = new Mock<IMongoDbIndexHandler>();
|
||||
|
||||
// Act
|
||||
await Sut.CreateAscendingIndexAsync<TestDocumentWithKey<int>, int>(keyedFieldExpression, partitionKey);
|
||||
|
||||
// Assert
|
||||
IndexHandler.Verify(
|
||||
x => x.CreateAscendingIndexAsync<TestDocumentWithKey<int>, int>(
|
||||
keyedFieldExpression, null, partitionKey, CancellationToken.None));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Keyed_WithFieldExpressionAndPartitionKeyAndCancellationToken_CreatesIndex()
|
||||
{
|
||||
// Arrange
|
||||
var partitionKey = Fixture.Create<string>();
|
||||
var token = new CancellationToken(true);
|
||||
IndexHandler = new Mock<IMongoDbIndexHandler>();
|
||||
|
||||
// Act
|
||||
await Sut.CreateAscendingIndexAsync<TestDocumentWithKey<int>, int>(keyedFieldExpression, partitionKey, token);
|
||||
|
||||
// Assert
|
||||
IndexHandler.Verify(
|
||||
x => x.CreateAscendingIndexAsync<TestDocumentWithKey<int>, int>(
|
||||
keyedFieldExpression, null, partitionKey, token));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Keyed_WithFieldExpressionAndOptionsAndPartitionKey_CreatesIndex()
|
||||
{
|
||||
// Arrange
|
||||
var partitionKey = Fixture.Create<string>();
|
||||
var indexName = Fixture.Create<string>();
|
||||
var options = new IndexCreationOptions { Name = indexName };
|
||||
|
||||
IndexHandler = new Mock<IMongoDbIndexHandler>();
|
||||
|
||||
// Act
|
||||
await Sut.CreateAscendingIndexAsync<TestDocumentWithKey<int>, int>(keyedFieldExpression, options, partitionKey);
|
||||
|
||||
// Assert
|
||||
IndexHandler.Verify(
|
||||
x => x.CreateAscendingIndexAsync<TestDocumentWithKey<int>, int>(
|
||||
keyedFieldExpression, options, partitionKey, CancellationToken.None));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Keyed_WithFieldExpressionAndOptionsAndPartitionKeyAndCancellationToken_CreatesIndex()
|
||||
{
|
||||
// Arrange
|
||||
var partitionKey = Fixture.Create<string>();
|
||||
var token = new CancellationToken(true);
|
||||
var indexName = Fixture.Create<string>();
|
||||
var options = new IndexCreationOptions { Name = indexName };
|
||||
|
||||
IndexHandler = new Mock<IMongoDbIndexHandler>();
|
||||
|
||||
// Act
|
||||
await Sut.CreateAscendingIndexAsync<TestDocumentWithKey<int>, int>(keyedFieldExpression, options, partitionKey, token);
|
||||
|
||||
// Assert
|
||||
IndexHandler.Verify(
|
||||
x => x.CreateAscendingIndexAsync<TestDocumentWithKey<int>, int>(
|
||||
keyedFieldExpression, options, partitionKey, token));
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
using System;
|
||||
using System.Linq.Expressions;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using CoreUnitTests.Infrastructure.Model;
|
||||
using MongoDbGenericRepository.DataAccess.Index;
|
||||
using Moq;
|
||||
using Xunit;
|
||||
|
||||
namespace CoreUnitTests.BaseMongoRepositoryTests.IndexTests;
|
||||
|
||||
public class CreateAscendingIndexTests : BaseIndexTests
|
||||
{
|
||||
/*[Fact]
|
||||
public async Task CreateAscendingIndexAsync_EnsureTokenPassed()
|
||||
{
|
||||
// Arrange
|
||||
IndexHandler = new Mock<IMongoDbIndexHandler>();
|
||||
var token = new CancellationToken(true);
|
||||
|
||||
// Act
|
||||
Expression<Func<TestDocument, object>> fieldExpression = t => t.SomeContent2;
|
||||
// await Sut.CreateAscendingIndexAsync<TestDocument>(fieldExpression, token);
|
||||
|
||||
// Assert
|
||||
IndexHandler.Verify(x => x.CreateAscendingIndexAsync<TestDocument, Guid>(
|
||||
fieldExpression, null, null, token));
|
||||
}*/
|
||||
}
|
||||
@@ -0,0 +1,294 @@
|
||||
using System;
|
||||
using System.Linq.Expressions;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using AutoFixture;
|
||||
using CoreUnitTests.Infrastructure.Model;
|
||||
using MongoDbGenericRepository.DataAccess.Index;
|
||||
using MongoDbGenericRepository.Models;
|
||||
using Moq;
|
||||
using Xunit;
|
||||
|
||||
namespace CoreUnitTests.BaseMongoRepositoryTests.IndexTests;
|
||||
|
||||
public class CreateDescendingIndexAsyncTests : BaseIndexTests
|
||||
{
|
||||
private readonly Expression<Func<TestDocumentWithKey<int>, object>> keyedFieldExpression = t => t.SomeContent2;
|
||||
private readonly Expression<Func<TestDocument, object>> fieldExpression = t => t.SomeContent2;
|
||||
|
||||
[Fact]
|
||||
public async Task WithFieldExpression_CreatesIndex()
|
||||
{
|
||||
// Arrange
|
||||
IndexHandler = new Mock<IMongoDbIndexHandler>();
|
||||
|
||||
// Act
|
||||
await Sut.CreateDescendingIndexAsync(fieldExpression);
|
||||
|
||||
// Assert
|
||||
IndexHandler.Verify(
|
||||
x => x.CreateDescendingIndexAsync<TestDocument, Guid>(fieldExpression, null, null, CancellationToken.None));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task WithFieldExpressionAndCancellationToken_CreatesIndex()
|
||||
{
|
||||
// Arrange
|
||||
var token = new CancellationToken(true);
|
||||
IndexHandler = new Mock<IMongoDbIndexHandler>();
|
||||
|
||||
// Act
|
||||
await Sut.CreateDescendingIndexAsync(fieldExpression, token);
|
||||
|
||||
// Assert
|
||||
IndexHandler.Verify(
|
||||
x => x.CreateDescendingIndexAsync<TestDocument, Guid>(fieldExpression, null, null, token));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task WithFieldExpressionAndOptions_CreatesIndex()
|
||||
{
|
||||
// Arrange
|
||||
var indexName = Fixture.Create<string>();
|
||||
var options = new IndexCreationOptions { Name = indexName };
|
||||
IndexHandler = new Mock<IMongoDbIndexHandler>();
|
||||
|
||||
// Act
|
||||
await Sut.CreateDescendingIndexAsync(fieldExpression, options);
|
||||
|
||||
// Assert
|
||||
IndexHandler.Verify(
|
||||
x => x.CreateDescendingIndexAsync<TestDocument, Guid>(
|
||||
fieldExpression, options, null, CancellationToken.None));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task WithFieldExpressionAndOptionsAndCancellationToken_CreatesIndex()
|
||||
{
|
||||
// Arrange
|
||||
var indexName = Fixture.Create<string>();
|
||||
var options = new IndexCreationOptions { Name = indexName };
|
||||
var token = new CancellationToken(true);
|
||||
IndexHandler = new Mock<IMongoDbIndexHandler>();
|
||||
|
||||
// Act
|
||||
await Sut.CreateDescendingIndexAsync(fieldExpression, options, token);
|
||||
|
||||
// Assert
|
||||
IndexHandler.Verify(
|
||||
x => x.CreateDescendingIndexAsync<TestDocument, Guid>(
|
||||
fieldExpression, options, null, token));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task WithFieldExpressionAndPartitionKey_CreatesIndex()
|
||||
{
|
||||
// Arrange
|
||||
var partitionKey = Fixture.Create<string>();
|
||||
IndexHandler = new Mock<IMongoDbIndexHandler>();
|
||||
|
||||
// Act
|
||||
await Sut.CreateDescendingIndexAsync(fieldExpression, partitionKey);
|
||||
|
||||
// Assert
|
||||
IndexHandler.Verify(
|
||||
x => x.CreateDescendingIndexAsync<TestDocument, Guid>(
|
||||
fieldExpression, null, partitionKey, CancellationToken.None));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task WithFieldExpressionAndPartitionKeyAndCancellationToken_CreatesIndex()
|
||||
{
|
||||
// Arrange
|
||||
var partitionKey = Fixture.Create<string>();
|
||||
var token = new CancellationToken(true);
|
||||
IndexHandler = new Mock<IMongoDbIndexHandler>();
|
||||
|
||||
// Act
|
||||
await Sut.CreateDescendingIndexAsync(fieldExpression, partitionKey, token);
|
||||
|
||||
// Assert
|
||||
IndexHandler.Verify(
|
||||
x => x.CreateDescendingIndexAsync<TestDocument, Guid>(
|
||||
fieldExpression, null, partitionKey, token));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task WithFieldExpressionAndOptionsAndPartitionKey_CreatesIndex()
|
||||
{
|
||||
// Arrange
|
||||
var partitionKey = Fixture.Create<string>();
|
||||
var indexName = Fixture.Create<string>();
|
||||
var options = new IndexCreationOptions { Name = indexName };
|
||||
|
||||
IndexHandler = new Mock<IMongoDbIndexHandler>();
|
||||
|
||||
// Act
|
||||
await Sut.CreateDescendingIndexAsync(fieldExpression, options, partitionKey);
|
||||
|
||||
// Assert
|
||||
IndexHandler.Verify(
|
||||
x => x.CreateDescendingIndexAsync<TestDocument, Guid>(
|
||||
fieldExpression, options, partitionKey, CancellationToken.None));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task WithFieldExpressionAndOptionsAndPartitionKeyAndCancellationToken_CreatesIndex()
|
||||
{
|
||||
// Arrange
|
||||
var partitionKey = Fixture.Create<string>();
|
||||
var token = new CancellationToken(true);
|
||||
var indexName = Fixture.Create<string>();
|
||||
var options = new IndexCreationOptions { Name = indexName };
|
||||
|
||||
IndexHandler = new Mock<IMongoDbIndexHandler>();
|
||||
|
||||
// Act
|
||||
await Sut.CreateDescendingIndexAsync(fieldExpression, options, partitionKey, token);
|
||||
|
||||
// Assert
|
||||
IndexHandler.Verify(
|
||||
x => x.CreateDescendingIndexAsync<TestDocument, Guid>(
|
||||
fieldExpression, options, partitionKey, token));
|
||||
}
|
||||
|
||||
#region Keyed
|
||||
|
||||
[Fact]
|
||||
public async Task Keyed_WithFieldExpression_CreatesIndex()
|
||||
{
|
||||
// Arrange
|
||||
IndexHandler = new Mock<IMongoDbIndexHandler>();
|
||||
|
||||
// Act
|
||||
await Sut.CreateDescendingIndexAsync<TestDocumentWithKey<int>, int>(keyedFieldExpression);
|
||||
|
||||
// Assert
|
||||
IndexHandler.Verify(
|
||||
x => x.CreateDescendingIndexAsync<TestDocumentWithKey<int>, int>(keyedFieldExpression, null, null, CancellationToken.None));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Keyed_WithFieldExpressionAndCancellationToken_CreatesIndex()
|
||||
{
|
||||
// Arrange
|
||||
var token = new CancellationToken(true);
|
||||
IndexHandler = new Mock<IMongoDbIndexHandler>();
|
||||
|
||||
// Act
|
||||
await Sut.CreateDescendingIndexAsync<TestDocumentWithKey<int>, int>(keyedFieldExpression, token);
|
||||
|
||||
// Assert
|
||||
IndexHandler.Verify(
|
||||
x => x.CreateDescendingIndexAsync<TestDocumentWithKey<int>, int>(keyedFieldExpression, null, null, token));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Keyed_WithFieldExpressionAndOptions_CreatesIndex()
|
||||
{
|
||||
// Arrange
|
||||
var indexName = Fixture.Create<string>();
|
||||
var options = new IndexCreationOptions { Name = indexName };
|
||||
IndexHandler = new Mock<IMongoDbIndexHandler>();
|
||||
|
||||
// Act
|
||||
await Sut.CreateDescendingIndexAsync<TestDocumentWithKey<int>, int>(keyedFieldExpression, options);
|
||||
|
||||
// Assert
|
||||
IndexHandler.Verify(
|
||||
x => x.CreateDescendingIndexAsync<TestDocumentWithKey<int>, int>(
|
||||
keyedFieldExpression, options, null, CancellationToken.None));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Keyed_WithFieldExpressionAndOptionsAndCancellationToken_CreatesIndex()
|
||||
{
|
||||
// Arrange
|
||||
var indexName = Fixture.Create<string>();
|
||||
var options = new IndexCreationOptions { Name = indexName };
|
||||
var token = new CancellationToken(true);
|
||||
IndexHandler = new Mock<IMongoDbIndexHandler>();
|
||||
|
||||
// Act
|
||||
await Sut.CreateDescendingIndexAsync<TestDocumentWithKey<int>, int>(keyedFieldExpression, options, token);
|
||||
|
||||
// Assert
|
||||
IndexHandler.Verify(
|
||||
x => x.CreateDescendingIndexAsync<TestDocumentWithKey<int>, int>(
|
||||
keyedFieldExpression, options, null, token));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Keyed_WithFieldExpressionAndPartitionKey_CreatesIndex()
|
||||
{
|
||||
// Arrange
|
||||
var partitionKey = Fixture.Create<string>();
|
||||
IndexHandler = new Mock<IMongoDbIndexHandler>();
|
||||
|
||||
// Act
|
||||
await Sut.CreateDescendingIndexAsync<TestDocumentWithKey<int>, int>(keyedFieldExpression, partitionKey);
|
||||
|
||||
// Assert
|
||||
IndexHandler.Verify(
|
||||
x => x.CreateDescendingIndexAsync<TestDocumentWithKey<int>, int>(
|
||||
keyedFieldExpression, null, partitionKey, CancellationToken.None));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Keyed_WithFieldExpressionAndPartitionKeyAndCancellationToken_CreatesIndex()
|
||||
{
|
||||
// Arrange
|
||||
var partitionKey = Fixture.Create<string>();
|
||||
var token = new CancellationToken(true);
|
||||
IndexHandler = new Mock<IMongoDbIndexHandler>();
|
||||
|
||||
// Act
|
||||
await Sut.CreateDescendingIndexAsync<TestDocumentWithKey<int>, int>(keyedFieldExpression, partitionKey, token);
|
||||
|
||||
// Assert
|
||||
IndexHandler.Verify(
|
||||
x => x.CreateDescendingIndexAsync<TestDocumentWithKey<int>, int>(
|
||||
keyedFieldExpression, null, partitionKey, token));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Keyed_WithFieldExpressionAndOptionsAndPartitionKey_CreatesIndex()
|
||||
{
|
||||
// Arrange
|
||||
var partitionKey = Fixture.Create<string>();
|
||||
var indexName = Fixture.Create<string>();
|
||||
var options = new IndexCreationOptions { Name = indexName };
|
||||
|
||||
IndexHandler = new Mock<IMongoDbIndexHandler>();
|
||||
|
||||
// Act
|
||||
await Sut.CreateDescendingIndexAsync<TestDocumentWithKey<int>, int>(keyedFieldExpression, options, partitionKey);
|
||||
|
||||
// Assert
|
||||
IndexHandler.Verify(
|
||||
x => x.CreateDescendingIndexAsync<TestDocumentWithKey<int>, int>(
|
||||
keyedFieldExpression, options, partitionKey, CancellationToken.None));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Keyed_WithFieldExpressionAndOptionsAndPartitionKeyAndCancellationToken_CreatesIndex()
|
||||
{
|
||||
// Arrange
|
||||
var partitionKey = Fixture.Create<string>();
|
||||
var token = new CancellationToken(true);
|
||||
var indexName = Fixture.Create<string>();
|
||||
var options = new IndexCreationOptions { Name = indexName };
|
||||
|
||||
IndexHandler = new Mock<IMongoDbIndexHandler>();
|
||||
|
||||
// Act
|
||||
await Sut.CreateDescendingIndexAsync<TestDocumentWithKey<int>, int>(keyedFieldExpression, options, partitionKey, token);
|
||||
|
||||
// Assert
|
||||
IndexHandler.Verify(
|
||||
x => x.CreateDescendingIndexAsync<TestDocumentWithKey<int>, int>(
|
||||
keyedFieldExpression, options, partitionKey, token));
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
+1
-1
@@ -11,7 +11,7 @@ using CancellationToken = System.Threading.CancellationToken;
|
||||
|
||||
namespace CoreUnitTests.BaseMongoRepositoryTests.IndexTests;
|
||||
|
||||
public class CreateTextIndexTests : BaseIndexTests
|
||||
public class CreateTextIndexAsyncTests : BaseIndexTests
|
||||
{
|
||||
private readonly Expression<Func<TestDocument, object>> fieldExpression = t => t.SomeContent2;
|
||||
private readonly Expression<Func<TestDocumentWithKey<int>, object>> keyedFieldExpression = t => t.SomeContent2;
|
||||
+1
-1
@@ -10,7 +10,7 @@ using Xunit;
|
||||
|
||||
namespace CoreUnitTests.BaseMongoRepositoryTests.IndexTests;
|
||||
|
||||
public class GetIndexNamesTests : BaseIndexTests
|
||||
public class GetIndexNamesAsyncTests : BaseIndexTests
|
||||
{
|
||||
[Fact]
|
||||
public async Task WithNoParameters_ReturnsIndexNames()
|
||||
@@ -6,18 +6,13 @@ namespace CoreUnitTests.Infrastructure;
|
||||
|
||||
public class GenericTestContext<TSut>
|
||||
{
|
||||
public GenericTestContext()
|
||||
{
|
||||
Fixture = new Fixture().Customize(new AutoMoqCustomization());
|
||||
}
|
||||
public GenericTestContext() => Fixture = new Fixture().Customize(new AutoMoqCustomization());
|
||||
|
||||
protected Mock<T> MockOf<T>()
|
||||
where T : class
|
||||
{
|
||||
return Fixture.Freeze<Mock<T>>();
|
||||
}
|
||||
where T : class =>
|
||||
Fixture.Freeze<Mock<T>>();
|
||||
|
||||
protected IFixture Fixture { get; set; }
|
||||
|
||||
protected TSut Sut { get => Fixture.Create<TSut>(); }
|
||||
protected TSut Sut => Fixture.Create<TSut>();
|
||||
}
|
||||
@@ -0,0 +1,154 @@
|
||||
using System;
|
||||
using System.Linq.Expressions;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using AutoFixture;
|
||||
using CoreUnitTests.Infrastructure;
|
||||
using CoreUnitTests.Infrastructure.Model;
|
||||
using MongoDbGenericRepository.DataAccess.Index;
|
||||
using MongoDbGenericRepository.Models;
|
||||
using Moq;
|
||||
using Xunit;
|
||||
|
||||
namespace CoreUnitTests.KeyTypedRepositoryTests.IndexTests;
|
||||
|
||||
public class CreateAscendingIndexAsyncTests : TestKeyedMongoRepositoryContext<int>
|
||||
{
|
||||
private readonly Expression<Func<TestDocumentWithKey<int>, object>> keyedFieldExpression = t => t.SomeContent2;
|
||||
|
||||
[Fact]
|
||||
public async Task WithFieldExpression_CreatesIndex()
|
||||
{
|
||||
// Arrange
|
||||
IndexHandler = new Mock<IMongoDbIndexHandler>();
|
||||
|
||||
// Act
|
||||
await Sut.CreateAscendingIndexAsync(keyedFieldExpression);
|
||||
|
||||
// Assert
|
||||
IndexHandler.Verify(
|
||||
x => x.CreateAscendingIndexAsync<TestDocumentWithKey<int>, int>(keyedFieldExpression, null, null, CancellationToken.None));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task WithFieldExpressionAndCancellationToken_CreatesIndex()
|
||||
{
|
||||
// Arrange
|
||||
var token = new CancellationToken(true);
|
||||
IndexHandler = new Mock<IMongoDbIndexHandler>();
|
||||
|
||||
// Act
|
||||
await Sut.CreateAscendingIndexAsync(keyedFieldExpression, token);
|
||||
|
||||
// Assert
|
||||
IndexHandler.Verify(
|
||||
x => x.CreateAscendingIndexAsync<TestDocumentWithKey<int>, int>(keyedFieldExpression, null, null, token));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task WithFieldExpressionAndOptions_CreatesIndex()
|
||||
{
|
||||
// Arrange
|
||||
var indexName = Fixture.Create<string>();
|
||||
var options = new IndexCreationOptions { Name = indexName };
|
||||
IndexHandler = new Mock<IMongoDbIndexHandler>();
|
||||
|
||||
// Act
|
||||
await Sut.CreateAscendingIndexAsync(keyedFieldExpression, options);
|
||||
|
||||
// Assert
|
||||
IndexHandler.Verify(
|
||||
x => x.CreateAscendingIndexAsync<TestDocumentWithKey<int>, int>(
|
||||
keyedFieldExpression, options, null, CancellationToken.None));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task WithFieldExpressionAndOptionsAndCancellationToken_CreatesIndex()
|
||||
{
|
||||
// Arrange
|
||||
var indexName = Fixture.Create<string>();
|
||||
var options = new IndexCreationOptions { Name = indexName };
|
||||
var token = new CancellationToken(true);
|
||||
IndexHandler = new Mock<IMongoDbIndexHandler>();
|
||||
|
||||
// Act
|
||||
await Sut.CreateAscendingIndexAsync(keyedFieldExpression, options, token);
|
||||
|
||||
// Assert
|
||||
IndexHandler.Verify(
|
||||
x => x.CreateAscendingIndexAsync<TestDocumentWithKey<int>, int>(
|
||||
keyedFieldExpression, options, null, token));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task WithFieldExpressionAndPartitionKey_CreatesIndex()
|
||||
{
|
||||
// Arrange
|
||||
var partitionKey = Fixture.Create<string>();
|
||||
IndexHandler = new Mock<IMongoDbIndexHandler>();
|
||||
|
||||
// Act
|
||||
await Sut.CreateAscendingIndexAsync(keyedFieldExpression, partitionKey);
|
||||
|
||||
// Assert
|
||||
IndexHandler.Verify(
|
||||
x => x.CreateAscendingIndexAsync<TestDocumentWithKey<int>, int>(
|
||||
keyedFieldExpression, null, partitionKey, CancellationToken.None));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task WithFieldExpressionAndPartitionKeyAndCancellationToken_CreatesIndex()
|
||||
{
|
||||
// Arrange
|
||||
var partitionKey = Fixture.Create<string>();
|
||||
var token = new CancellationToken(true);
|
||||
IndexHandler = new Mock<IMongoDbIndexHandler>();
|
||||
|
||||
// Act
|
||||
await Sut.CreateAscendingIndexAsync(keyedFieldExpression, partitionKey, token);
|
||||
|
||||
// Assert
|
||||
IndexHandler.Verify(
|
||||
x => x.CreateAscendingIndexAsync<TestDocumentWithKey<int>, int>(
|
||||
keyedFieldExpression, null, partitionKey, token));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task WithFieldExpressionAndOptionsAndPartitionKey_CreatesIndex()
|
||||
{
|
||||
// Arrange
|
||||
var partitionKey = Fixture.Create<string>();
|
||||
var indexName = Fixture.Create<string>();
|
||||
var options = new IndexCreationOptions { Name = indexName };
|
||||
|
||||
IndexHandler = new Mock<IMongoDbIndexHandler>();
|
||||
|
||||
// Act
|
||||
await Sut.CreateAscendingIndexAsync(keyedFieldExpression, options, partitionKey);
|
||||
|
||||
// Assert
|
||||
IndexHandler.Verify(
|
||||
x => x.CreateAscendingIndexAsync<TestDocumentWithKey<int>, int>(
|
||||
keyedFieldExpression, options, partitionKey, CancellationToken.None));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task WithFieldExpressionAndOptionsAndPartitionKeyAndCancellationToken_CreatesIndex()
|
||||
{
|
||||
// Arrange
|
||||
var partitionKey = Fixture.Create<string>();
|
||||
var token = new CancellationToken(true);
|
||||
var indexName = Fixture.Create<string>();
|
||||
var options = new IndexCreationOptions { Name = indexName };
|
||||
|
||||
IndexHandler = new Mock<IMongoDbIndexHandler>();
|
||||
|
||||
// Act
|
||||
await Sut.CreateAscendingIndexAsync(keyedFieldExpression, options, partitionKey, token);
|
||||
|
||||
// Assert
|
||||
IndexHandler.Verify(
|
||||
x => x.CreateAscendingIndexAsync<TestDocumentWithKey<int>, int>(
|
||||
keyedFieldExpression, options, partitionKey, token));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,154 @@
|
||||
using System;
|
||||
using System.Linq.Expressions;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using AutoFixture;
|
||||
using CoreUnitTests.Infrastructure;
|
||||
using CoreUnitTests.Infrastructure.Model;
|
||||
using MongoDbGenericRepository.DataAccess.Index;
|
||||
using MongoDbGenericRepository.Models;
|
||||
using Moq;
|
||||
using Xunit;
|
||||
|
||||
namespace CoreUnitTests.KeyTypedRepositoryTests.IndexTests;
|
||||
|
||||
public class CreateDescendingIndexAsyncTests : TestKeyedMongoRepositoryContext<int>
|
||||
{
|
||||
private readonly Expression<Func<TestDocumentWithKey<int>, object>> keyedFieldExpression = t => t.SomeContent2;
|
||||
|
||||
[Fact]
|
||||
public async Task WithFieldExpression_CreatesIndex()
|
||||
{
|
||||
// Arrange
|
||||
IndexHandler = new Mock<IMongoDbIndexHandler>();
|
||||
|
||||
// Act
|
||||
await Sut.CreateDescendingIndexAsync(keyedFieldExpression);
|
||||
|
||||
// Assert
|
||||
IndexHandler.Verify(
|
||||
x => x.CreateDescendingIndexAsync<TestDocumentWithKey<int>, int>(keyedFieldExpression, null, null, CancellationToken.None));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task WithFieldExpressionAndCancellationToken_CreatesIndex()
|
||||
{
|
||||
// Arrange
|
||||
var token = new CancellationToken(true);
|
||||
IndexHandler = new Mock<IMongoDbIndexHandler>();
|
||||
|
||||
// Act
|
||||
await Sut.CreateDescendingIndexAsync(keyedFieldExpression, token);
|
||||
|
||||
// Assert
|
||||
IndexHandler.Verify(
|
||||
x => x.CreateDescendingIndexAsync<TestDocumentWithKey<int>, int>(keyedFieldExpression, null, null, token));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task WithFieldExpressionAndOptions_CreatesIndex()
|
||||
{
|
||||
// Arrange
|
||||
var indexName = Fixture.Create<string>();
|
||||
var options = new IndexCreationOptions { Name = indexName };
|
||||
IndexHandler = new Mock<IMongoDbIndexHandler>();
|
||||
|
||||
// Act
|
||||
await Sut.CreateDescendingIndexAsync(keyedFieldExpression, options);
|
||||
|
||||
// Assert
|
||||
IndexHandler.Verify(
|
||||
x => x.CreateDescendingIndexAsync<TestDocumentWithKey<int>, int>(
|
||||
keyedFieldExpression, options, null, CancellationToken.None));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task WithFieldExpressionAndOptionsAndCancellationToken_CreatesIndex()
|
||||
{
|
||||
// Arrange
|
||||
var indexName = Fixture.Create<string>();
|
||||
var options = new IndexCreationOptions { Name = indexName };
|
||||
var token = new CancellationToken(true);
|
||||
IndexHandler = new Mock<IMongoDbIndexHandler>();
|
||||
|
||||
// Act
|
||||
await Sut.CreateDescendingIndexAsync(keyedFieldExpression, options, token);
|
||||
|
||||
// Assert
|
||||
IndexHandler.Verify(
|
||||
x => x.CreateDescendingIndexAsync<TestDocumentWithKey<int>, int>(
|
||||
keyedFieldExpression, options, null, token));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task WithFieldExpressionAndPartitionKey_CreatesIndex()
|
||||
{
|
||||
// Arrange
|
||||
var partitionKey = Fixture.Create<string>();
|
||||
IndexHandler = new Mock<IMongoDbIndexHandler>();
|
||||
|
||||
// Act
|
||||
await Sut.CreateDescendingIndexAsync(keyedFieldExpression, partitionKey);
|
||||
|
||||
// Assert
|
||||
IndexHandler.Verify(
|
||||
x => x.CreateDescendingIndexAsync<TestDocumentWithKey<int>, int>(
|
||||
keyedFieldExpression, null, partitionKey, CancellationToken.None));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task WithFieldExpressionAndPartitionKeyAndCancellationToken_CreatesIndex()
|
||||
{
|
||||
// Arrange
|
||||
var partitionKey = Fixture.Create<string>();
|
||||
var token = new CancellationToken(true);
|
||||
IndexHandler = new Mock<IMongoDbIndexHandler>();
|
||||
|
||||
// Act
|
||||
await Sut.CreateDescendingIndexAsync(keyedFieldExpression, partitionKey, token);
|
||||
|
||||
// Assert
|
||||
IndexHandler.Verify(
|
||||
x => x.CreateDescendingIndexAsync<TestDocumentWithKey<int>, int>(
|
||||
keyedFieldExpression, null, partitionKey, token));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task WithFieldExpressionAndOptionsAndPartitionKey_CreatesIndex()
|
||||
{
|
||||
// Arrange
|
||||
var partitionKey = Fixture.Create<string>();
|
||||
var indexName = Fixture.Create<string>();
|
||||
var options = new IndexCreationOptions { Name = indexName };
|
||||
|
||||
IndexHandler = new Mock<IMongoDbIndexHandler>();
|
||||
|
||||
// Act
|
||||
await Sut.CreateDescendingIndexAsync(keyedFieldExpression, options, partitionKey);
|
||||
|
||||
// Assert
|
||||
IndexHandler.Verify(
|
||||
x => x.CreateDescendingIndexAsync<TestDocumentWithKey<int>, int>(
|
||||
keyedFieldExpression, options, partitionKey, CancellationToken.None));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task WithFieldExpressionAndOptionsAndPartitionKeyAndCancellationToken_CreatesIndex()
|
||||
{
|
||||
// Arrange
|
||||
var partitionKey = Fixture.Create<string>();
|
||||
var token = new CancellationToken(true);
|
||||
var indexName = Fixture.Create<string>();
|
||||
var options = new IndexCreationOptions { Name = indexName };
|
||||
|
||||
IndexHandler = new Mock<IMongoDbIndexHandler>();
|
||||
|
||||
// Act
|
||||
await Sut.CreateDescendingIndexAsync(keyedFieldExpression, options, partitionKey, token);
|
||||
|
||||
// Assert
|
||||
IndexHandler.Verify(
|
||||
x => x.CreateDescendingIndexAsync<TestDocumentWithKey<int>, int>(
|
||||
keyedFieldExpression, options, partitionKey, token));
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,9 @@
|
||||
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
|
||||
@@ -23,7 +23,10 @@ namespace MongoDbGenericRepository
|
||||
{
|
||||
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>
|
||||
{
|
||||
|
||||
@@ -172,6 +172,91 @@ namespace MongoDbGenericRepository
|
||||
where TDocument : IDocument<TKey>
|
||||
where TKey : IEquatable<TKey>;
|
||||
|
||||
/// <summary>
|
||||
/// Creates an index on the given field in ascending order.
|
||||
/// IndexCreationOptions can be supplied to further specify
|
||||
/// how the creation should be done.
|
||||
/// </summary>
|
||||
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
|
||||
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
|
||||
/// <param name="field">The field we want to index.</param>
|
||||
/// <returns>The result of the create index operation.</returns>
|
||||
Task<string> CreateAscendingIndexAsync<TDocument, TKey>(Expression<Func<TDocument, object>> field)
|
||||
where TDocument : IDocument<TKey>
|
||||
where TKey : IEquatable<TKey>;
|
||||
|
||||
/// <summary>
|
||||
/// Creates an index on the given field in ascending order.
|
||||
/// IndexCreationOptions can be supplied to further specify
|
||||
/// how the creation should be done.
|
||||
/// </summary>
|
||||
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
|
||||
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
|
||||
/// <param name="field">The field we want to index.</param>
|
||||
/// <param name="cancellationToken">The cancellation token.</param>
|
||||
/// <returns>The result of the create index operation.</returns>
|
||||
Task<string> CreateAscendingIndexAsync<TDocument, TKey>(Expression<Func<TDocument, object>> field, CancellationToken cancellationToken)
|
||||
where TDocument : IDocument<TKey>
|
||||
where TKey : IEquatable<TKey>;
|
||||
|
||||
/// <summary>
|
||||
/// Creates an index on the given field in ascending order.
|
||||
/// IndexCreationOptions can be supplied to further specify
|
||||
/// how the creation should be done.
|
||||
/// </summary>
|
||||
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
|
||||
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
|
||||
/// <param name="field">The field we want to index.</param>
|
||||
/// <param name="indexCreationOptions">Options for creating an index.</param>
|
||||
/// <returns>The result of the create index operation.</returns>
|
||||
Task<string> CreateAscendingIndexAsync<TDocument, TKey>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions)
|
||||
where TDocument : IDocument<TKey>
|
||||
where TKey : IEquatable<TKey>;
|
||||
|
||||
/// <summary>
|
||||
/// Creates an index on the given field in ascending order.
|
||||
/// IndexCreationOptions can be supplied to further specify
|
||||
/// how the creation should be done.
|
||||
/// </summary>
|
||||
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
|
||||
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
|
||||
/// <param name="field">The field we want to index.</param>
|
||||
/// <param name="indexCreationOptions">Options for creating an index.</param>
|
||||
/// <param name="cancellationToken">The cancellation token.</param>
|
||||
/// <returns>The result of the create index operation.</returns>
|
||||
Task<string> CreateAscendingIndexAsync<TDocument, TKey>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions, CancellationToken cancellationToken)
|
||||
where TDocument : IDocument<TKey>
|
||||
where TKey : IEquatable<TKey>;
|
||||
|
||||
/// <summary>
|
||||
/// Creates an index on the given field in ascending order.
|
||||
/// IndexCreationOptions can be supplied to further specify
|
||||
/// how the creation should be done.
|
||||
/// </summary>
|
||||
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
|
||||
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
|
||||
/// <param name="field">The field we want to index.</param>
|
||||
/// <param name="partitionKey">An optional partition key.</param>
|
||||
/// <returns>The result of the create index operation.</returns>
|
||||
Task<string> CreateAscendingIndexAsync<TDocument, TKey>(Expression<Func<TDocument, object>> field, string partitionKey)
|
||||
where TDocument : IDocument<TKey>
|
||||
where TKey : IEquatable<TKey>;
|
||||
|
||||
/// <summary>
|
||||
/// Creates an index on the given field in ascending order.
|
||||
/// IndexCreationOptions can be supplied to further specify
|
||||
/// how the creation should be done.
|
||||
/// </summary>
|
||||
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
|
||||
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
|
||||
/// <param name="field">The field we want to index.</param>
|
||||
/// <param name="partitionKey">An optional partition key.</param>
|
||||
/// <param name="cancellationToken">The cancellation token.</param>
|
||||
/// <returns>The result of the create index operation.</returns>
|
||||
Task<string> CreateAscendingIndexAsync<TDocument, TKey>(Expression<Func<TDocument, object>> field, string partitionKey, CancellationToken cancellationToken)
|
||||
where TDocument : IDocument<TKey>
|
||||
where TKey : IEquatable<TKey>;
|
||||
|
||||
/// <summary>
|
||||
/// Creates an index on the given field in ascending order.
|
||||
/// IndexCreationOptions can be supplied to further specify
|
||||
@@ -183,7 +268,108 @@ namespace MongoDbGenericRepository
|
||||
/// <param name="indexCreationOptions">Options for creating an index.</param>
|
||||
/// <param name="partitionKey">An optional partition key.</param>
|
||||
/// <returns>The result of the create index operation.</returns>
|
||||
Task<string> CreateAscendingIndexAsync<TDocument, TKey>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions = null, string partitionKey = null)
|
||||
Task<string> CreateAscendingIndexAsync<TDocument, TKey>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions, string partitionKey)
|
||||
where TDocument : IDocument<TKey>
|
||||
where TKey : IEquatable<TKey>;
|
||||
|
||||
/// <summary>
|
||||
/// Creates an index on the given field in ascending order.
|
||||
/// IndexCreationOptions can be supplied to further specify
|
||||
/// how the creation should be done.
|
||||
/// </summary>
|
||||
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
|
||||
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
|
||||
/// <param name="field">The field we want to index.</param>
|
||||
/// <param name="indexCreationOptions">Options for creating an index.</param>
|
||||
/// <param name="partitionKey">An optional partition key.</param>
|
||||
/// <param name="cancellationToken">The cancellation token.</param>
|
||||
/// <returns>The result of the create index operation.</returns>
|
||||
Task<string> CreateAscendingIndexAsync<TDocument, TKey>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions, string partitionKey, CancellationToken cancellationToken)
|
||||
where TDocument : IDocument<TKey>
|
||||
where TKey : IEquatable<TKey>;
|
||||
|
||||
/// <summary>
|
||||
/// Creates an index on the given field in descending order.
|
||||
/// IndexCreationOptions can be supplied to further specify
|
||||
/// how the creation should be done.
|
||||
/// </summary>
|
||||
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
|
||||
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
|
||||
/// <param name="field">The field we want to index.</param>
|
||||
/// <returns>The result of the create index operation.</returns>
|
||||
Task<string> CreateDescendingIndexAsync<TDocument, TKey>(Expression<Func<TDocument, object>> field)
|
||||
where TDocument : IDocument<TKey>
|
||||
where TKey : IEquatable<TKey>;
|
||||
|
||||
/// <summary>
|
||||
/// Creates an index on the given field in descending order.
|
||||
/// IndexCreationOptions can be supplied to further specify
|
||||
/// how the creation should be done.
|
||||
/// </summary>
|
||||
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
|
||||
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
|
||||
/// <param name="field">The field we want to index.</param>
|
||||
/// <param name="cancellationToken">The cancellation token.</param>
|
||||
/// <returns>The result of the create index operation.</returns>
|
||||
Task<string> CreateDescendingIndexAsync<TDocument, TKey>(Expression<Func<TDocument, object>> field, CancellationToken cancellationToken)
|
||||
where TDocument : IDocument<TKey>
|
||||
where TKey : IEquatable<TKey>;
|
||||
|
||||
/// <summary>
|
||||
/// Creates an index on the given field in descending order.
|
||||
/// IndexCreationOptions can be supplied to further specify
|
||||
/// how the creation should be done.
|
||||
/// </summary>
|
||||
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
|
||||
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
|
||||
/// <param name="field">The field we want to index.</param>
|
||||
/// <param name="indexCreationOptions">Options for creating an index.</param>
|
||||
/// <returns>The result of the create index operation.</returns>
|
||||
Task<string> CreateDescendingIndexAsync<TDocument, TKey>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions)
|
||||
where TDocument : IDocument<TKey>
|
||||
where TKey : IEquatable<TKey>;
|
||||
|
||||
/// <summary>
|
||||
/// Creates an index on the given field in descending order.
|
||||
/// IndexCreationOptions can be supplied to further specify
|
||||
/// how the creation should be done.
|
||||
/// </summary>
|
||||
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
|
||||
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
|
||||
/// <param name="field">The field we want to index.</param>
|
||||
/// <param name="indexCreationOptions">Options for creating an index.</param>
|
||||
/// <param name="cancellationToken">The cancellation token.</param>
|
||||
/// <returns>The result of the create index operation.</returns>
|
||||
Task<string> CreateDescendingIndexAsync<TDocument, TKey>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions, CancellationToken cancellationToken)
|
||||
where TDocument : IDocument<TKey>
|
||||
where TKey : IEquatable<TKey>;
|
||||
|
||||
/// <summary>
|
||||
/// Creates an index on the given field in descending order.
|
||||
/// IndexCreationOptions can be supplied to further specify
|
||||
/// how the creation should be done.
|
||||
/// </summary>
|
||||
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
|
||||
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
|
||||
/// <param name="field">The field we want to index.</param>
|
||||
/// <param name="partitionKey">An optional partition key.</param>
|
||||
/// <returns>The result of the create index operation.</returns>
|
||||
Task<string> CreateDescendingIndexAsync<TDocument, TKey>(Expression<Func<TDocument, object>> field, string partitionKey)
|
||||
where TDocument : IDocument<TKey>
|
||||
where TKey : IEquatable<TKey>;
|
||||
|
||||
/// <summary>
|
||||
/// Creates an index on the given field in descending order.
|
||||
/// IndexCreationOptions can be supplied to further specify
|
||||
/// how the creation should be done.
|
||||
/// </summary>
|
||||
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
|
||||
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
|
||||
/// <param name="field">The field we want to index.</param>
|
||||
/// <param name="partitionKey">An optional partition key.</param>
|
||||
/// <param name="cancellationToken">The cancellation token.</param>
|
||||
/// <returns>The result of the create index operation.</returns>
|
||||
Task<string> CreateDescendingIndexAsync<TDocument, TKey>(Expression<Func<TDocument, object>> field, string partitionKey, CancellationToken cancellationToken)
|
||||
where TDocument : IDocument<TKey>
|
||||
where TKey : IEquatable<TKey>;
|
||||
|
||||
@@ -198,7 +384,23 @@ namespace MongoDbGenericRepository
|
||||
/// <param name="indexCreationOptions">Options for creating an index.</param>
|
||||
/// <param name="partitionKey">An optional partition key.</param>
|
||||
/// <returns>The result of the create index operation.</returns>
|
||||
Task<string> CreateDescendingIndexAsync<TDocument, TKey>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions = null, string partitionKey = null)
|
||||
Task<string> CreateDescendingIndexAsync<TDocument, TKey>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions, string partitionKey)
|
||||
where TDocument : IDocument<TKey>
|
||||
where TKey : IEquatable<TKey>;
|
||||
|
||||
/// <summary>
|
||||
/// Creates an index on the given field in descending order.
|
||||
/// IndexCreationOptions can be supplied to further specify
|
||||
/// how the creation should be done.
|
||||
/// </summary>
|
||||
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
|
||||
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
|
||||
/// <param name="field">The field we want to index.</param>
|
||||
/// <param name="indexCreationOptions">Options for creating an index.</param>
|
||||
/// <param name="partitionKey">An optional partition key.</param>
|
||||
/// <param name="cancellationToken">The cancellation token.</param>
|
||||
/// <returns>The result of the create index operation.</returns>
|
||||
Task<string> CreateDescendingIndexAsync<TDocument, TKey>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions, string partitionKey, CancellationToken cancellationToken)
|
||||
where TDocument : IDocument<TKey>
|
||||
where TKey : IEquatable<TKey>;
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
using MongoDbGenericRepository.DataAccess.Index;
|
||||
using MongoDbGenericRepository.Models;
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq.Expressions;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using CancellationToken = System.Threading.CancellationToken;
|
||||
using MongoDbGenericRepository.DataAccess.Index;
|
||||
using MongoDbGenericRepository.Models;
|
||||
|
||||
namespace MongoDbGenericRepository
|
||||
{
|
||||
@@ -24,7 +24,10 @@ namespace MongoDbGenericRepository
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_mongoDbIndexHandler != null) { return _mongoDbIndexHandler; }
|
||||
if (_mongoDbIndexHandler != null)
|
||||
{
|
||||
return _mongoDbIndexHandler;
|
||||
}
|
||||
|
||||
lock (_initLock)
|
||||
{
|
||||
@@ -36,7 +39,7 @@ namespace MongoDbGenericRepository
|
||||
|
||||
return _mongoDbIndexHandler;
|
||||
}
|
||||
set { _mongoDbIndexHandler = value; }
|
||||
set => _mongoDbIndexHandler = value;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
@@ -89,14 +92,20 @@ namespace MongoDbGenericRepository
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public virtual async Task<string> CreateTextIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions, CancellationToken cancellationToken)
|
||||
public virtual async Task<string> CreateTextIndexAsync<TDocument>(
|
||||
Expression<Func<TDocument, object>> field,
|
||||
IndexCreationOptions indexCreationOptions,
|
||||
CancellationToken cancellationToken)
|
||||
where TDocument : IDocument<TKey>
|
||||
{
|
||||
return await CreateTextIndexAsync(field, indexCreationOptions, null, cancellationToken);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public virtual async Task<string> CreateTextIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions, string partitionKey)
|
||||
public virtual async Task<string> CreateTextIndexAsync<TDocument>(
|
||||
Expression<Func<TDocument, object>> field,
|
||||
IndexCreationOptions indexCreationOptions,
|
||||
string partitionKey)
|
||||
where TDocument : IDocument<TKey>
|
||||
{
|
||||
return await CreateTextIndexAsync(field, indexCreationOptions, partitionKey, CancellationToken.None);
|
||||
@@ -110,31 +119,168 @@ namespace MongoDbGenericRepository
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public virtual async Task<string> CreateTextIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, string partitionKey, CancellationToken cancellationToken)
|
||||
public virtual async Task<string> CreateTextIndexAsync<TDocument>(
|
||||
Expression<Func<TDocument, object>> field,
|
||||
string partitionKey,
|
||||
CancellationToken cancellationToken)
|
||||
where TDocument : IDocument<TKey>
|
||||
{
|
||||
return await CreateTextIndexAsync(field, null, partitionKey, cancellationToken);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public virtual async Task<string> CreateTextIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions, string partitionKey, CancellationToken cancellationToken)
|
||||
public virtual async Task<string> CreateTextIndexAsync<TDocument>(
|
||||
Expression<Func<TDocument, object>> field,
|
||||
IndexCreationOptions indexCreationOptions,
|
||||
string partitionKey,
|
||||
CancellationToken cancellationToken)
|
||||
where TDocument : IDocument<TKey>
|
||||
{
|
||||
return await MongoDbIndexHandler.CreateTextIndexAsync<TDocument, TKey>(field, indexCreationOptions, partitionKey, cancellationToken);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public virtual async Task<string> CreateAscendingIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions = null, string partitionKey = null)
|
||||
public virtual async Task<string> CreateAscendingIndexAsync<TDocument>(Expression<Func<TDocument, object>> field)
|
||||
where TDocument : IDocument<TKey>
|
||||
{
|
||||
return await MongoDbIndexHandler.CreateAscendingIndexAsync<TDocument, TKey>(field, indexCreationOptions, partitionKey);
|
||||
return await CreateAscendingIndexAsync(field, null, null, CancellationToken.None);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public virtual async Task<string> CreateDescendingIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions = null, string partitionKey = null)
|
||||
public virtual async Task<string> CreateAscendingIndexAsync<TDocument>(
|
||||
Expression<Func<TDocument, object>> field,
|
||||
CancellationToken cancellationToken)
|
||||
where TDocument : IDocument<TKey>
|
||||
{
|
||||
return await MongoDbIndexHandler.CreateDescendingIndexAsync<TDocument, TKey>(field, indexCreationOptions, partitionKey);
|
||||
return await CreateAscendingIndexAsync(field, null, null, cancellationToken);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public virtual async Task<string> CreateAscendingIndexAsync<TDocument>(
|
||||
Expression<Func<TDocument, object>> field,
|
||||
IndexCreationOptions indexCreationOptions)
|
||||
where TDocument : IDocument<TKey>
|
||||
{
|
||||
return await CreateAscendingIndexAsync(field, indexCreationOptions, null, CancellationToken.None);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public virtual async Task<string> CreateAscendingIndexAsync<TDocument>(
|
||||
Expression<Func<TDocument, object>> field,
|
||||
IndexCreationOptions indexCreationOptions,
|
||||
CancellationToken cancellationToken)
|
||||
where TDocument : IDocument<TKey>
|
||||
{
|
||||
return await CreateAscendingIndexAsync(field, indexCreationOptions, null, cancellationToken);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public virtual async Task<string> CreateAscendingIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, string partitionKey)
|
||||
where TDocument : IDocument<TKey>
|
||||
{
|
||||
return await CreateAscendingIndexAsync(field, null, partitionKey, CancellationToken.None);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public virtual async Task<string> CreateAscendingIndexAsync<TDocument>(
|
||||
Expression<Func<TDocument, object>> field,
|
||||
string partitionKey,
|
||||
CancellationToken cancellationToken)
|
||||
where TDocument : IDocument<TKey>
|
||||
{
|
||||
return await CreateAscendingIndexAsync(field, null, partitionKey, cancellationToken);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public virtual async Task<string> CreateAscendingIndexAsync<TDocument>(
|
||||
Expression<Func<TDocument, object>> field,
|
||||
IndexCreationOptions indexCreationOptions,
|
||||
string partitionKey)
|
||||
where TDocument : IDocument<TKey>
|
||||
{
|
||||
return await CreateAscendingIndexAsync(field, indexCreationOptions, partitionKey, CancellationToken.None);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public virtual async Task<string> CreateAscendingIndexAsync<TDocument>(
|
||||
Expression<Func<TDocument, object>> field,
|
||||
IndexCreationOptions indexCreationOptions,
|
||||
string partitionKey,
|
||||
CancellationToken cancellationToken)
|
||||
where TDocument : IDocument<TKey>
|
||||
{
|
||||
return await MongoDbIndexHandler.CreateAscendingIndexAsync<TDocument, TKey>(field, indexCreationOptions, partitionKey, cancellationToken);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public virtual async Task<string> CreateDescendingIndexAsync<TDocument>(Expression<Func<TDocument, object>> field)
|
||||
where TDocument : IDocument<TKey>
|
||||
{
|
||||
return await CreateDescendingIndexAsync(field, null, null, CancellationToken.None);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public virtual async Task<string> CreateDescendingIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, CancellationToken cancellationToken)
|
||||
where TDocument : IDocument<TKey>
|
||||
{
|
||||
return await CreateDescendingIndexAsync(field, null, null, cancellationToken);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public virtual async Task<string> CreateDescendingIndexAsync<TDocument>(
|
||||
Expression<Func<TDocument, object>> field,
|
||||
IndexCreationOptions indexCreationOptions)
|
||||
where TDocument : IDocument<TKey>
|
||||
{
|
||||
return await CreateDescendingIndexAsync(field, indexCreationOptions, null, CancellationToken.None);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public virtual async Task<string> CreateDescendingIndexAsync<TDocument>(
|
||||
Expression<Func<TDocument, object>> field,
|
||||
IndexCreationOptions indexCreationOptions,
|
||||
CancellationToken cancellationToken)
|
||||
where TDocument : IDocument<TKey>
|
||||
{
|
||||
return await CreateDescendingIndexAsync(field, indexCreationOptions, null, cancellationToken);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public virtual async Task<string> CreateDescendingIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, string partitionKey)
|
||||
where TDocument : IDocument<TKey>
|
||||
{
|
||||
return await CreateDescendingIndexAsync(field, null, partitionKey, CancellationToken.None);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public virtual async Task<string> CreateDescendingIndexAsync<TDocument>(
|
||||
Expression<Func<TDocument, object>> field,
|
||||
string partitionKey,
|
||||
CancellationToken cancellationToken)
|
||||
where TDocument : IDocument<TKey>
|
||||
{
|
||||
return await CreateDescendingIndexAsync(field, null, partitionKey, cancellationToken);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public virtual async Task<string> CreateDescendingIndexAsync<TDocument>(
|
||||
Expression<Func<TDocument, object>> field,
|
||||
IndexCreationOptions indexCreationOptions,
|
||||
string partitionKey)
|
||||
where TDocument : IDocument<TKey>
|
||||
{
|
||||
return await CreateDescendingIndexAsync(field, indexCreationOptions, partitionKey, CancellationToken.None);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public virtual async Task<string> CreateDescendingIndexAsync<TDocument>(
|
||||
Expression<Func<TDocument, object>> field,
|
||||
IndexCreationOptions indexCreationOptions,
|
||||
string partitionKey,
|
||||
CancellationToken cancellationToken)
|
||||
where TDocument : IDocument<TKey>
|
||||
{
|
||||
return await MongoDbIndexHandler.CreateDescendingIndexAsync<TDocument, TKey>(field, indexCreationOptions, partitionKey, cancellationToken);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
||||
@@ -149,6 +149,80 @@ namespace MongoDbGenericRepository
|
||||
Task<string> CreateTextIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions, string partitionKey, CancellationToken cancellationToken)
|
||||
where TDocument : IDocument<TKey>;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Creates an index on the given field in ascending order.
|
||||
/// IndexCreationOptions can be supplied to further specify
|
||||
/// how the creation should be done.
|
||||
/// </summary>
|
||||
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
|
||||
/// <param name="field">The field we want to index.</param>
|
||||
/// <returns>The result of the create index operation.</returns>
|
||||
Task<string> CreateAscendingIndexAsync<TDocument>(Expression<Func<TDocument, object>> field)
|
||||
where TDocument : IDocument<TKey>;
|
||||
|
||||
/// <summary>
|
||||
/// Creates an index on the given field in ascending order.
|
||||
/// IndexCreationOptions can be supplied to further specify
|
||||
/// how the creation should be done.
|
||||
/// </summary>
|
||||
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
|
||||
/// <param name="field">The field we want to index.</param>
|
||||
/// <param name="cancellationToken">The cancellation token.</param>
|
||||
/// <returns>The result of the create index operation.</returns>
|
||||
Task<string> CreateAscendingIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, CancellationToken cancellationToken)
|
||||
where TDocument : IDocument<TKey>;
|
||||
|
||||
/// <summary>
|
||||
/// Creates an index on the given field in ascending order.
|
||||
/// IndexCreationOptions can be supplied to further specify
|
||||
/// how the creation should be done.
|
||||
/// </summary>
|
||||
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
|
||||
/// <param name="field">The field we want to index.</param>
|
||||
/// <param name="indexCreationOptions">Options for creating an index.</param>
|
||||
/// <returns>The result of the create index operation.</returns>
|
||||
Task<string> CreateAscendingIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions)
|
||||
where TDocument : IDocument<TKey>;
|
||||
|
||||
/// <summary>
|
||||
/// Creates an index on the given field in ascending order.
|
||||
/// IndexCreationOptions can be supplied to further specify
|
||||
/// how the creation should be done.
|
||||
/// </summary>
|
||||
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
|
||||
/// <param name="field">The field we want to index.</param>
|
||||
/// <param name="indexCreationOptions">Options for creating an index.</param>
|
||||
/// <param name="cancellationToken">The cancellation token.</param>
|
||||
/// <returns>The result of the create index operation.</returns>
|
||||
Task<string> CreateAscendingIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions, CancellationToken cancellationToken)
|
||||
where TDocument : IDocument<TKey>;
|
||||
|
||||
/// <summary>
|
||||
/// Creates an index on the given field in ascending order.
|
||||
/// IndexCreationOptions can be supplied to further specify
|
||||
/// how the creation should be done.
|
||||
/// </summary>
|
||||
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
|
||||
/// <param name="field">The field we want to index.</param>
|
||||
/// <param name="partitionKey">An optional partition key.</param>
|
||||
/// <returns>The result of the create index operation.</returns>
|
||||
Task<string> CreateAscendingIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, string partitionKey)
|
||||
where TDocument : IDocument<TKey>;
|
||||
|
||||
/// <summary>
|
||||
/// Creates an index on the given field in ascending order.
|
||||
/// IndexCreationOptions can be supplied to further specify
|
||||
/// how the creation should be done.
|
||||
/// </summary>
|
||||
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
|
||||
/// <param name="field">The field we want to index.</param>
|
||||
/// <param name="partitionKey">An optional partition key.</param>
|
||||
/// <param name="cancellationToken">The cancellation token.</param>
|
||||
/// <returns>The result of the create index operation.</returns>
|
||||
Task<string> CreateAscendingIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, string partitionKey, CancellationToken cancellationToken)
|
||||
where TDocument : IDocument<TKey>;
|
||||
|
||||
/// <summary>
|
||||
/// Creates an index on the given field in ascending order.
|
||||
/// IndexCreationOptions can be supplied to further specify
|
||||
@@ -159,7 +233,94 @@ namespace MongoDbGenericRepository
|
||||
/// <param name="indexCreationOptions">Options for creating an index.</param>
|
||||
/// <param name="partitionKey">An optional partition key.</param>
|
||||
/// <returns>The result of the create index operation.</returns>
|
||||
Task<string> CreateAscendingIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions = null, string partitionKey = null)
|
||||
Task<string> CreateAscendingIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions, string partitionKey)
|
||||
where TDocument : IDocument<TKey>;
|
||||
|
||||
/// <summary>
|
||||
/// Creates an index on the given field in ascending order.
|
||||
/// IndexCreationOptions can be supplied to further specify
|
||||
/// how the creation should be done.
|
||||
/// </summary>
|
||||
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
|
||||
/// <param name="field">The field we want to index.</param>
|
||||
/// <param name="indexCreationOptions">Options for creating an index.</param>
|
||||
/// <param name="partitionKey">An optional partition key.</param>
|
||||
/// <param name="cancellationToken">The cancellation token.</param>
|
||||
/// <returns>The result of the create index operation.</returns>
|
||||
Task<string> CreateAscendingIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions, string partitionKey, CancellationToken cancellationToken)
|
||||
where TDocument : IDocument<TKey>;
|
||||
|
||||
/// <summary>
|
||||
/// Creates an index on the given field in descending order.
|
||||
/// IndexCreationOptions can be supplied to further specify
|
||||
/// how the creation should be done.
|
||||
/// </summary>
|
||||
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
|
||||
/// <param name="field">The field we want to index.</param>
|
||||
/// <returns>The result of the create index operation.</returns>
|
||||
Task<string> CreateDescendingIndexAsync<TDocument>(Expression<Func<TDocument, object>> field)
|
||||
where TDocument : IDocument<TKey>;
|
||||
|
||||
/// <summary>
|
||||
/// Creates an index on the given field in descending order.
|
||||
/// IndexCreationOptions can be supplied to further specify
|
||||
/// how the creation should be done.
|
||||
/// </summary>
|
||||
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
|
||||
/// <param name="field">The field we want to index.</param>
|
||||
/// <param name="cancellationToken">The cancellation token.</param>
|
||||
/// <returns>The result of the create index operation.</returns>
|
||||
Task<string> CreateDescendingIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, CancellationToken cancellationToken)
|
||||
where TDocument : IDocument<TKey>;
|
||||
|
||||
/// <summary>
|
||||
/// Creates an index on the given field in descending order.
|
||||
/// IndexCreationOptions can be supplied to further specify
|
||||
/// how the creation should be done.
|
||||
/// </summary>
|
||||
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
|
||||
/// <param name="field">The field we want to index.</param>
|
||||
/// <param name="indexCreationOptions">Options for creating an index.</param>
|
||||
/// <returns>The result of the create index operation.</returns>
|
||||
Task<string> CreateDescendingIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions)
|
||||
where TDocument : IDocument<TKey>;
|
||||
|
||||
/// <summary>
|
||||
/// Creates an index on the given field in descending order.
|
||||
/// IndexCreationOptions can be supplied to further specify
|
||||
/// how the creation should be done.
|
||||
/// </summary>
|
||||
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
|
||||
/// <param name="field">The field we want to index.</param>
|
||||
/// <param name="indexCreationOptions">Options for creating an index.</param>
|
||||
/// <param name="cancellationToken">The cancellation token.</param>
|
||||
/// <returns>The result of the create index operation.</returns>
|
||||
Task<string> CreateDescendingIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions, CancellationToken cancellationToken)
|
||||
where TDocument : IDocument<TKey>;
|
||||
|
||||
/// <summary>
|
||||
/// Creates an index on the given field in descending order.
|
||||
/// IndexCreationOptions can be supplied to further specify
|
||||
/// how the creation should be done.
|
||||
/// </summary>
|
||||
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
|
||||
/// <param name="field">The field we want to index.</param>
|
||||
/// <param name="partitionKey">An optional partition key.</param>
|
||||
/// <returns>The result of the create index operation.</returns>
|
||||
Task<string> CreateDescendingIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, string partitionKey)
|
||||
where TDocument : IDocument<TKey>;
|
||||
|
||||
/// <summary>
|
||||
/// Creates an index on the given field in descending order.
|
||||
/// IndexCreationOptions can be supplied to further specify
|
||||
/// how the creation should be done.
|
||||
/// </summary>
|
||||
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
|
||||
/// <param name="field">The field we want to index.</param>
|
||||
/// <param name="partitionKey">An optional partition key.</param>
|
||||
/// <param name="cancellationToken">The cancellation token.</param>
|
||||
/// <returns>The result of the create index operation.</returns>
|
||||
Task<string> CreateDescendingIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, string partitionKey, CancellationToken cancellationToken)
|
||||
where TDocument : IDocument<TKey>;
|
||||
|
||||
/// <summary>
|
||||
@@ -172,7 +333,21 @@ namespace MongoDbGenericRepository
|
||||
/// <param name="indexCreationOptions">Options for creating an index.</param>
|
||||
/// <param name="partitionKey">An optional partition key.</param>
|
||||
/// <returns>The result of the create index operation.</returns>
|
||||
Task<string> CreateDescendingIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions = null, string partitionKey = null)
|
||||
Task<string> CreateDescendingIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions, string partitionKey)
|
||||
where TDocument : IDocument<TKey>;
|
||||
|
||||
/// <summary>
|
||||
/// Creates an index on the given field in descending order.
|
||||
/// IndexCreationOptions can be supplied to further specify
|
||||
/// how the creation should be done.
|
||||
/// </summary>
|
||||
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
|
||||
/// <param name="field">The field we want to index.</param>
|
||||
/// <param name="indexCreationOptions">Options for creating an index.</param>
|
||||
/// <param name="partitionKey">An optional partition key.</param>
|
||||
/// <param name="cancellationToken">The cancellation token.</param>
|
||||
/// <returns>The result of the create index operation.</returns>
|
||||
Task<string> CreateDescendingIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions, string partitionKey, CancellationToken cancellationToken)
|
||||
where TDocument : IDocument<TKey>;
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user