Line data Source code
1 : #region Copyright
2 : // // -----------------------------------------------------------------------
3 : // // <copyright company="Chinchilla Software Limited">
4 : // // Copyright Chinchilla Software Limited. All rights reserved.
5 : // // </copyright>
6 : // // -----------------------------------------------------------------------
7 : #endregion
8 :
9 : using System;
10 : using System.Linq.Expressions;
11 : using Cqrs.Events;
12 : using Cqrs.MongoDB.DataStores.Indexes;
13 :
14 : namespace Cqrs.MongoDB.Events.Indexes
15 : {
16 : /// <summary>
17 : /// A <see cref="MongoDbIndex{TEntity}"/> for <see cref="EventData.AggregateId"/> and <see cref="EventData.Version"/>.
18 : /// </summary>
19 : public class ByAggregateIdAndVersionMongoDbIndex : MongoDbIndex<MongoDbEventData>
20 1 : {
21 : /// <summary>
22 : /// Instantiate a new instance of <see cref="ByAggregateIdAndVersionMongoDbIndex"/>.
23 : /// </summary>
24 1 : public ByAggregateIdAndVersionMongoDbIndex()
25 : {
26 : Selectors = new Expression<Func<MongoDbEventData, object>>[]
27 : {
28 : entity => entity.AggregateId,
29 : entity => entity.Version
30 : };
31 :
32 : IsUnique = true;
33 : }
34 : }
35 : }
|