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