Line data Source code
1 : using System;
2 : using System.Collections.Generic;
3 :
4 : namespace Cqrs.Mongo.DataStores.Indexes
5 : {
6 : public abstract class MongoIndex<TEntity>
7 0 : {
8 : /// <summary>
9 : /// Indicates if the index enforces unique values. Defaults to false.
10 : /// </summary>
11 : public bool IsUnique { get; protected set; }
12 :
13 : /// <summary>
14 : /// Indicates if the index is in ascending order or descending. Defaults to true meaning ascending order.
15 : /// </summary>
16 : public bool IsAcending { get; protected set; }
17 :
18 : /// <summary>
19 : /// The name of the index. Default to the class name removing any instances of "Index" and "MongoIndex" from the name.
20 : /// </summary>
21 : public string Name { get; protected set; }
22 :
23 : public IEnumerable<System.Linq.Expressions.Expression<Func<TEntity, object>>> Selectors { get; protected set; }
24 :
25 0 : protected MongoIndex()
26 : {
27 : IsUnique = false;
28 : IsAcending = true;
29 : Name = GetType()
30 : .Name
31 : .Replace("MongoIndex", string.Empty)
32 : .Replace("Index", string.Empty);
33 : }
34 : }
35 : }
|