using MongoDB.Bson.Serialization.Attributes; using System; namespace MongoDbGenericRepository.Models { /// /// This class represents a basic document that can be stored in MongoDb /// public class Document : IDocument { /// /// The document constructor /// public Document() { Id = Guid.NewGuid(); AddedAtUtc = DateTime.UtcNow; } /// /// The Id of the document /// [BsonId] public Guid Id { get; set; } /// /// The datetime in UTC at which the document was added. /// public DateTime AddedAtUtc { get; set; } /// /// The version of the schema of the document /// public int Version { get; set; } } public class PartitionedDocument : Document, IPartitionedDocument { public PartitionedDocument(string partitionKey) { PartitionKey = partitionKey; } /// /// The name of the property used for partitioning the collection /// This will not be inserted into the collection. /// This partition key will be prepended to the collection name to create a new collection. /// public string PartitionKey { get; set; } } }