Files
mongodb-generic-repository/MongoDbGenericRepository/Models/IDocument.cs
T
alexandre-spieser 1d985e0274 Added tests
2017-09-24 21:34:29 +00:00

31 lines
1.1 KiB
C#

using MongoDB.Bson.Serialization.Attributes;
using System;
namespace MongoDbGenericRepository.Models
{
/// <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<TKey> where TKey : IEquatable<TKey>
{
/// <summary>
/// The Primary Key, which must be decorated with the [BsonId] attribute
/// if you want the MongoDb C# driver to consider it to be the document ID.
/// </summary>
[BsonId]
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>
{
}
}