Generated nuget package 1.2 and tests passing.
This commit is contained in:
@@ -4,7 +4,8 @@ using System;
|
||||
namespace MongoDbGenericRepository.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// This class represents a basic document that can be stored in MongoDb
|
||||
/// 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 class Document : IDocument
|
||||
{
|
||||
@@ -33,18 +34,4 @@ namespace MongoDbGenericRepository.Models
|
||||
/// </summary>
|
||||
public int Version { get; set; }
|
||||
}
|
||||
|
||||
public class PartitionedDocument : Document, IPartitionedDocument
|
||||
{
|
||||
public PartitionedDocument(string partitionKey)
|
||||
{
|
||||
PartitionKey = partitionKey;
|
||||
}
|
||||
/// <summary>
|
||||
/// 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.
|
||||
/// </summary>
|
||||
public string PartitionKey { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -8,19 +8,18 @@ namespace MongoDbGenericRepository.Models
|
||||
/// </summary>
|
||||
public interface IDocument
|
||||
{
|
||||
/// <summary>
|
||||
/// The date and UTC time at which the document was added to the collection.
|
||||
/// </summary>
|
||||
DateTime AddedAtUtc { get; set; }
|
||||
/// <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; }
|
||||
/// <summary>
|
||||
/// A version number, to indicate the version of the schema.
|
||||
/// </summary>
|
||||
int Version { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This class represents a document that can be inserted in a collection that can be partitioned.
|
||||
/// The partition key allows for the creation of different collections having the same document schema.
|
||||
/// This can be useful if you are planning to build a Software as a Service (SaaS) Platform, or if you want to reduce indexing.
|
||||
/// You could for example insert Logs in different collections based on the week and year they where created, or their Log category/source.
|
||||
/// </summary>
|
||||
public interface IPartitionedDocument : IDocument
|
||||
{
|
||||
string PartitionKey { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
namespace MongoDbGenericRepository.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// This class represents a document that can be inserted in a collection that can be partitioned.
|
||||
/// The partition key allows for the creation of different collections having the same document schema.
|
||||
/// This can be useful if you are planning to build a Software as a Service (SaaS) Platform, or if you want to reduce indexing.
|
||||
/// You could for example insert Logs in different collections based on the week and year they where created, or their Log category/source.
|
||||
/// </summary>
|
||||
public interface IPartitionedDocument : IDocument
|
||||
{
|
||||
/// <summary>
|
||||
/// The partition key used to partition your collection.
|
||||
/// </summary>
|
||||
string PartitionKey { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
namespace MongoDbGenericRepository.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// This class represents a document that can be inserted in a collection that can be partitioned.
|
||||
/// The partition key allows for the creation of different collections having the same document schema.
|
||||
/// This can be useful if you are planning to build a Software as a Service (SaaS) Platform, or if you want to reduce indexing.
|
||||
/// You could for example insert Logs in different collections based on the week and year they where created, or their Log category/source.
|
||||
/// </summary>
|
||||
public class PartitionedDocument : Document, IPartitionedDocument
|
||||
{
|
||||
/// <summary>
|
||||
/// The constructor, it needs a partition key.
|
||||
/// </summary>
|
||||
/// <param name="partitionKey"></param>
|
||||
public PartitionedDocument(string partitionKey)
|
||||
{
|
||||
PartitionKey = partitionKey;
|
||||
}
|
||||
/// <summary>
|
||||
/// 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.
|
||||
/// </summary>
|
||||
public string PartitionKey { get; set; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user