Files
mongodb-generic-repository/MongoDbGenericRepository/Models/IDocument.cs
T
2017-10-29 19:29:43 +00:00

30 lines
1.0 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>
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>
{
}
}