Soenneker.Documents.Document 4.0.2695

Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
dotnet add package Soenneker.Documents.Document --version 4.0.2695
                    
NuGet\Install-Package Soenneker.Documents.Document -Version 4.0.2695
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Soenneker.Documents.Document" Version="4.0.2695" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Soenneker.Documents.Document" Version="4.0.2695" />
                    
Directory.Packages.props
<PackageReference Include="Soenneker.Documents.Document" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Soenneker.Documents.Document --version 4.0.2695
                    
#r "nuget: Soenneker.Documents.Document, 4.0.2695"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Soenneker.Documents.Document@4.0.2695
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Soenneker.Documents.Document&version=4.0.2695
                    
Install as a Cake Addin
#tool nuget:?package=Soenneker.Documents.Document&version=4.0.2695
                    
Install as a Cake Tool

alternate text is missing from this package README image alternate text is missing from this package README image alternate text is missing from this package README image alternate text is missing from this package README image

Soenneker.Documents.Document

Provides a base document model with storage identity, partition, and timestamp fields.

Installation

dotnet add package Soenneker.Documents.Document

Define a document

using Soenneker.Documents.Document;

public sealed class CustomerDocument : Document
{
    public string Name { get; set; } = null!;
}

var customer = new CustomerDocument
{
    DocumentId = "customer-42",
    PartitionKey = "tenant-7",
    CreatedAt = DateTimeOffset.UtcNow,
    Name = "Ada Lovelace"
};

string? internalId = customer.Id; // tenant-7:customer-42

DocumentId serializes as id; PartitionKey serializes as partitionKey. CreatedAt and ModifiedAt serialize as createdAt and modifiedAt. These names are declared for both System.Text.Json and Newtonsoft.Json.

Id is an internal convenience value and is ignored by both serializers. Its behavior is:

  • If one key is missing, it returns the other.
  • If both keys are equal, it returns that value once.
  • If the keys differ, it returns PartitionKey:DocumentId.
  • Assigning a value containing colons splits at the last colon.
  • Assigning a value without a colon sets both PartitionKey and DocumentId to that value.
  • Assigning null, empty, or whitespace does nothing.

Because the format has no escaping, DocumentId should not contain a colon when Id must round-trip through its setter. A partition key may contain colons because parsing reserves the final segment for DocumentId.

customer.Id = "tenant:region:customer-42";

// PartitionKey == "tenant:region"
// DocumentId == "customer-42"

New instances do not automatically receive identifiers or timestamps. The [Required] attributes provide validation metadata but do not initialize values or make mutable instances thread-safe; populate and validate documents before persistence.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (6)

Showing the top 5 NuGet packages that depend on Soenneker.Documents.Document:

Package Downloads
Soenneker.Documents.Audit

A derivation of Document that specifically exists for audit purposes

Soenneker.Documents.Named

Providing a name property on Document

Soenneker.AutoFaker.Overrides.Documents.Document

An AutoFaker (AutoBogus) override for the base Document object

Soenneker.Zelos.Repository

A data persistence abstraction layer for Zelos DB

Soenneker.Extensions.Enumerable.Document

A collection of helpful IEnumerable Document extension methods

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
4.0.2698 0 8/30/2026
4.0.2697 0 8/30/2026
4.0.2696 49 8/30/2026
4.0.2695 50 8/30/2026
4.0.2694 47 8/30/2026
4.0.2693 99 8/29/2026
4.0.2691 277 8/29/2026
4.0.2690 706 8/26/2026
4.0.2689 378 8/25/2026
4.0.2688 836 8/21/2026
4.0.2687 1,059 8/18/2026
4.0.2686 436 8/18/2026
4.0.2685 1,221 8/12/2026
4.0.2684 1,098 8/8/2026
4.0.2683 847 8/7/2026
4.0.2682 977 7/29/2026
4.0.2681 650 7/28/2026
4.0.2680 260 7/28/2026
4.0.2679 526 7/28/2026
4.0.2678 299 7/28/2026
Loading failed

Update dependency Soenneker.Extensions.String to 4.0.728 (#3584)