first step to split function into separate classes for better reuse and easier maintenance.
This commit is contained in:
@@ -9,7 +9,7 @@ namespace MongoDbGenericRepository
|
||||
/// <summary>
|
||||
/// The repository interface for managing indexes
|
||||
/// </summary>
|
||||
public interface IMongoDbCollectionIndexRepository
|
||||
public interface IMongoDbCollectionIndexRepository : IBaseMongoDbIndexRepository
|
||||
{
|
||||
/// <summary>
|
||||
/// Create a text index on the given field.
|
||||
@@ -24,21 +24,6 @@ namespace MongoDbGenericRepository
|
||||
Task<string> CreateTextIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions = null, string partitionKey = null)
|
||||
where TDocument : IDocument;
|
||||
|
||||
/// <summary>
|
||||
/// Create a text index on the given field.
|
||||
/// 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>
|
||||
/// <returns>The result of the create index operation.</returns>
|
||||
Task<string> CreateTextIndexAsync<TDocument, TKey>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions = null, string partitionKey = null)
|
||||
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
|
||||
@@ -51,21 +36,6 @@ namespace MongoDbGenericRepository
|
||||
/// <returns>The result of the create index operation.</returns>
|
||||
Task<string> CreateAscendingIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions = null, string partitionKey = null) where TDocument : IDocument;
|
||||
|
||||
/// <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>
|
||||
/// <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)
|
||||
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
|
||||
@@ -79,21 +49,6 @@ namespace MongoDbGenericRepository
|
||||
Task<string> CreateDescendingIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions = null, string partitionKey = null)
|
||||
where TDocument : IDocument;
|
||||
|
||||
/// <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>
|
||||
/// <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)
|
||||
where TDocument : IDocument<TKey>
|
||||
where TKey : IEquatable<TKey>;
|
||||
|
||||
/// <summary>
|
||||
/// Creates a hashed index on the given field.
|
||||
/// IndexCreationOptions can be supplied to further specify
|
||||
@@ -107,21 +62,6 @@ namespace MongoDbGenericRepository
|
||||
Task<string> CreateHashedIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions = null, string partitionKey = null)
|
||||
where TDocument : IDocument;
|
||||
|
||||
/// <summary>
|
||||
/// Creates a hashed index on the given field.
|
||||
/// 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>
|
||||
/// <returns>The result of the create index operation.</returns>
|
||||
Task<string> CreateHashedIndexAsync<TDocument, TKey>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions = null, string partitionKey = null)
|
||||
where TDocument : IDocument<TKey>
|
||||
where TKey : IEquatable<TKey>;
|
||||
|
||||
/// <summary>
|
||||
/// Creates a combined text index.
|
||||
/// IndexCreationOptions can be supplied to further specify
|
||||
@@ -135,21 +75,6 @@ namespace MongoDbGenericRepository
|
||||
Task<string> CreateCombinedTextIndexAsync<TDocument>(IEnumerable<Expression<Func<TDocument, object>>> fields, IndexCreationOptions indexCreationOptions = null, string partitionKey = null)
|
||||
where TDocument : IDocument;
|
||||
|
||||
/// <summary>
|
||||
/// Creates a combined text index.
|
||||
/// 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="fields">The fields we want to index.</param>
|
||||
/// <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> CreateCombinedTextIndexAsync<TDocument, TKey>(IEnumerable<Expression<Func<TDocument, object>>> fields, IndexCreationOptions indexCreationOptions = null, string partitionKey = null)
|
||||
where TDocument : IDocument<TKey>
|
||||
where TKey : IEquatable<TKey>;
|
||||
|
||||
/// <summary>
|
||||
/// Drops the index given a field name
|
||||
/// </summary>
|
||||
@@ -159,17 +84,6 @@ namespace MongoDbGenericRepository
|
||||
Task DropIndexAsync<TDocument>(string indexName, string partitionKey = null)
|
||||
where TDocument : IDocument;
|
||||
|
||||
/// <summary>
|
||||
/// Drops the index given a field name
|
||||
/// </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="indexName">The name of the index</param>
|
||||
/// <param name="partitionKey">An optional partition key</param>
|
||||
Task DropIndexAsync<TDocument, TKey>(string indexName, string partitionKey = null)
|
||||
where TDocument : IDocument<TKey>
|
||||
where TKey : IEquatable<TKey>;
|
||||
|
||||
/// <summary>
|
||||
/// Returns the names of the indexes present on a collection.
|
||||
/// </summary>
|
||||
@@ -178,16 +92,5 @@ namespace MongoDbGenericRepository
|
||||
/// <returns>A list containing the names of the indexes on on the concerned collection.</returns>
|
||||
Task<List<string>> GetIndexesNamesAsync<TDocument>(string partitionKey = null)
|
||||
where TDocument : IDocument;
|
||||
|
||||
/// <summary>
|
||||
/// Returns the names of the indexes present on a collection.
|
||||
/// </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="partitionKey">An optional partition key</param>
|
||||
/// <returns>A list containing the names of the indexes on on the concerned collection.</returns>
|
||||
Task<List<string>> GetIndexesNamesAsync<TDocument, TKey>(string partitionKey = null)
|
||||
where TDocument : IDocument<TKey>
|
||||
where TKey : IEquatable<TKey>;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user