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