Adding TKey support

This commit is contained in:
alexandre-spieser
2017-09-23 22:00:31 +00:00
parent 5e187e0b1f
commit 9b1048e318
5 changed files with 417 additions and 78 deletions
+10 -2
View File
@@ -6,16 +6,24 @@ namespace MongoDbGenericRepository.Models
/// This class represents a basic document that can be stored in MongoDb.
/// Your document must implement this class in order for the MongoDbRepository to handle them.
/// </summary>
public interface IDocument
public interface IDocument<TKey> where TKey : IEquatable<TKey>
{
/// <summary>
/// The Guid, which must be decorated with the [BsonId] attribute
/// if you want the MongoDb C# driver to consider it to be the document ID.
/// </summary>
Guid Id { get; set; }
TKey Id { get; set; }
/// <summary>
/// A version number, to indicate the version of the schema.
/// </summary>
int Version { get; set; }
}
/// <summary>
/// This class represents a basic document that can be stored in MongoDb.
/// Your document must implement this class in order for the MongoDbRepository to handle them.
/// </summary>
public interface IDocument: IDocument<Guid>
{
}
}