MondoCore.Data 3.0.1

dotnet add package MondoCore.Data --version 3.0.1
                    
NuGet\Install-Package MondoCore.Data -Version 3.0.1
                    
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="MondoCore.Data" Version="3.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="MondoCore.Data" Version="3.0.1" />
                    
Directory.Packages.props
<PackageReference Include="MondoCore.Data" />
                    
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 MondoCore.Data --version 3.0.1
                    
#r "nuget: MondoCore.Data, 3.0.1"
                    
#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 MondoCore.Data@3.0.1
                    
#: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=MondoCore.Data&version=3.0.1
                    
Install as a Cake Addin
#tool nuget:?package=MondoCore.Data&version=3.0.1
                    
Install as a Cake Tool

MondoCore.Data

<br>

A collection of interfaces and classes for accessing data from databases and other data sources

Table of Contents

<br/>

<a name="interfaces"></a>

Interfaces


<a name="readrepo"></a>

IReadRepository

Read data from a repository (data source)

<a name="readrepo"></a>

Task<TValue> Get(TID id, CancellationToken cancellationToken = default)

Retrieve a single object with the given id

<a name="readrepo"></a>

IAsyncEnumerable<TValue> Get(IEnumerable<TID> ids, CancellationToken cancellationToken = default)

Retrieve a list of objects with the given ids

<a name="readrepo"></a>, CancellationToken cancellationToken

IAsyncEnumerable<TValue> Get(Expression<Func<TValue, bool>> query, CancellationToken cancellationToken = default)

Query for a list of objects that match the given expression

public IAsyncEnumerable<Customer> GetCustomers(string city)
{
    return _reader.Get( (c)=> c.City == city);
}

<a name="writerepo"></a>

IWriteRepository

Write data to a repository (data source)

Task<TValue> Insert(TValue item, CancellationToken cancellationToken = default)

Insert a new object into the repository

Task Insert(IEnumerable<TValue> items, CancellationToken cancellationToken = default)

Insert a list of objects into the repository

Task<bool> Update(TValue item, Expression<Func<TValue, bool>> guard = null, CancellationToken cancellationToken = default)

Update a single object with a guard

await _writer.Update(customer, (c)=> c.Status == "active");

Task<long> Update(object properties, Expression<Func<TValue, bool>> query, CancellationToken cancellationToken = default);

Retrieve a list of objects that match the given query and update the given properties. Returns the number of items updated.

// Change city of all the items with city of "Lower Junction" to "Springfield"
await _writer.Update( new { City = "Springfield" }, (item)=> item.City == "Lower Junction");
Task<long> Update(Func<TValue, Task<(bool Update, bool Continue)>> update, Expression<Func<TValue, bool>> query, CancellationToken cancellationToken = default);

Retrieve a list of objects that match the given query and updates using the given lambda expression to modify properties. Returns the number of items updated.

// Change city of all the items with city of "Lower Junction" to "Springfield"
await _writer.Update( (i)=>
{
    i.City = "Springfield",

    return Task.FromResult((true, true));
},
(item)=> item.City == "Lower Junction");
Task<bool> Delete(TID id, CancellationToken cancellationToken = default)

Delete a single object

Task<long> Delete(Expression<Func<TValue, bool>> guard, CancellationToken cancellationToken = default)

Delete a list of objects that match the given query. Returns the number of items deleted.

await _writer.Delete( (item)=> item.Status == "Archived");

<a name="database"></a>

IDatabase

Retrieve read and write repository interfaces from a database. A repository may be a sql database table or a collection in a NoSql database.

IReadRepository<TID, TValue> GetRepositoryReader<TID, TValue>(string repoName, IIdentifierStrategy<TID> strategy = null) where TValue : IIdentifiable<TID>, new()

Retrieve a reader for a repository with the given name and identifier strategy

IWriteRepository<TID, TValue> GetRepositoryWriter<TID, TValue>(string repoName, IIdentifierStrategy<TID> strategy = null) where TValue : IIdentifiable<TID>, new()

Retrieve a writer for a repository with the given name and identifier strategy

(extension) IReadRepository<TID, TValue> GetRepositoryReader<TID, TValue>(string repoName, string partitionKey) where TValue : IIdentifiable<TID>, new()

Retrieve a reader for a repository with the given name using a fixed identifier strategy

(extension) IWriteRepository<TID, TValue> GetRepositoryWriter<TID, TValue>(string repoName, string partitionKey) where TValue : IIdentifiable<TID>, new()

Retrieve a writer for a repository with the given name using a fixed identifier strategy


<a name="identifiable"></a>

IIdentifiable<TID>

The value type for a respository must derive from the interface.

TID Id

<a name="identifier"></a>

IIdentifierStrategy<TID>

The read and write interfaces take a single identifier but certain kinds of repositories/databases might also take a partition key. This interface specifies how to extract the partition key.


<a name="partitionable"></a>

IPartitionable<TID>

If a repository is partitioned then the value type for a respository must derive from the interface.

string GetPartitionKey()

<a name="ipartitionedid"></a>

IPartitionedId

Represents an object with a repository item id and a partition key

string Id
string PartitionKey

<a name="itable"></a>

ITable

Retrieve read and write interfaces for a table (e.g. Azure storage tables).

ITableReader<TValue> Reader

Retrieve a reader for the table

ITableWriter<TValue> Writer

Retrieve a writer for the table


<a name="itablereader"></a>

ITableReader

Provides read access to a table (e.g. Azure storage tables).

Task<TValue> Get(string id, CancellationToken cancellationToken)

Retrieve a single object with the given id

Task<TValue> Get(string id, string? partitionKey, CancellationToken cancellationToken = default)

Retrieve a single object with the given id and partition key

IAsyncEnumerable<TValue> Get(IEnumerable<TID> ids, CancellationToken cancellationToken = default)

Retrieve a list of objects with the given ids

IAsyncEnumerable<TValue> Get(Expression<Func<TValue, bool>> query, CancellationToken cancellationToken = default)

Query for a list of objects that match the given expression

public IAsyncEnumerable<Customer> GetCustomers(string city)
{
    return _reader.Get( (c)=> c.City == city);
}

<a name="itablewriter"></a>

ITableWriter

Provides write access to a table (e.g. Azure storage tables).

Task<TValue> Insert(TValue item, CancellationToken cancellationToken = default)

Insert a new record into the table

Task Insert(IEnumerable<TValue> items, CancellationToken cancellationToken = default)

Insert a list of records into the table

Task<bool> Update(TValue item, Expression<Func<TValue, bool>> guard = null, CancellationToken cancellationToken = default)

Update a single record with a guard

await _writer.Update(customer, (c)=> c.Status == "active");
Task<long> Update(object properties, Expression<Func<TValue, bool>> query, CancellationToken cancellationToken);

Retrieve a list of recrods that match the given query and update the given properties. Returns the number of records updated.

// Change city of all the records with city of "Lower Junction" to "Springfield"
await _writer.Update( new { City = "Springfield" }, (item)=> item.City == "Lower Junction");
Task<long> Update(Func<TValue, Task<(bool Update, bool Continue)>> update, Expression<Func<TValue, bool>> query, CancellationToken cancellationToken = default);

Retrieve a list of records that match the given query and updates them using the given lambda expression to modify properties. Returns the number of records updated.

// Change city of all the records with city of "Lower Junction" to "Springfield"
await _writer.Update( (i)=>
{
    i.City = "Springfield",

    return Task.FromResult((true, true));
},
(item)=> item.City == "Lower Junction");
Task<bool> Delete(TID id, CancellationToken cancellationToken = default)

Delete a single object

Task<long> Delete(Expression<Func<TValue, bool>> guard, CancellationToken cancellationToken = default)

Delete a list of records that match the given query. Returns the number of records deleted.

await _writer.Delete( (item)=> item.Status == "Archived");

<br/>

<a name="classes"></a>

Classes


<a name="cachedrepo"></a>

CachedRepository<TID, TValue> : IReadRepository<TID, TValue>

Provides a way to cache the contents of a repository (as needed) using another repository, usually a memory only repository.


<a name="partitionedid"></a>

PartitionedId : IPartitionedId

A model class that contains an identifier and a partiton key.

string Id
string PartitionKey

<a name="delimitedidentifierstrategy"></a>

DelimitedIdentifierStrategy<TID> : IIdentifierStrategy<TID>

Represents a strategy where the key passed into a repository reader/writer is a delimited id and partition key, e.g. "id;partitionkey"


<a name="fixedidentifierstrategy"></a>

FixedIdentifierStrategy<TID> : IIdentifierStrategy<TID>

Represents a strategy where the key passed into a repository reader/writer is a fixed partition key and the key is the identifier alone.


<a name="propertyidentifierstrategy"></a>

PropertyIdentifierStrategy<TID, TVALUE> : IIdentifierStrategy<TID, TVALUE>

Represents a strategy where the key passed into a repository reader/writer is a property name from the object.


<a name="notfound"></a>

NotFoundException

An exception to indicate when an object was not found

<br>

<a name="extensions"></a>

Extensions

<br>

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  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. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (4)

Showing the top 4 NuGet packages that depend on MondoCore.Data:

Package Downloads
MondoCore.Azure.CosmosDB

Implementation of MondoCore.Data interfaces for CosmosDB (SQL API)

MondoCore.MongoDB

Implementation of MondoCode.Data interfaces for MongoDB

MondoCore.Azure.Tables

Access Azure storage tables or the Table API in Cosmos

MondoCore.Data.Log

A ILog (MondoCore.Log) wrapper around the IWriteRespository in MondoCore.Data to write telemetry to a database

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
3.0.1 109 2/25/2026
3.0.0 121 2/24/2026
2.6.1 90 2/21/2026
2.6.0 89 2/21/2026
2.5.2 91 2/20/2026
2.5.1 146 2/13/2026
2.5.0 127 2/11/2026
2.1.0 364 5/18/2025
2.0.0 326 10/24/2024
1.0.2 553 8/13/2021
1.0.1 585 7/29/2021
1.0.0 926 3/20/2021