AzureCosmoHelperCore 1.0.0

dotnet add package AzureCosmoHelperCore --version 1.0.0                
NuGet\Install-Package AzureCosmoHelperCore -Version 1.0.0                
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="AzureCosmoHelperCore" Version="1.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add AzureCosmoHelperCore --version 1.0.0                
#r "nuget: AzureCosmoHelperCore, 1.0.0"                
#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.
// Install AzureCosmoHelperCore as a Cake Addin
#addin nuget:?package=AzureCosmoHelperCore&version=1.0.0

// Install AzureCosmoHelperCore as a Cake Tool
#tool nuget:?package=AzureCosmoHelperCore&version=1.0.0                

Microsoft.Cosmo.Crud.Helper

build nuget

Microsoft.Cosmo.Crud.Helper is a .NET library that simplifies working with Azure Cosmos DB, providing straightforward asynchronous operations to manage items within your Cosmos containers. This package abstracts complex queries and operations into easy-to-use methods for common tasks such as creating, updating, deleting, and querying items.

Features

  • CRUD Operations: Easily create, read, update, and delete items in your Cosmos DB container.
  • Asynchronous Support: All operations are designed to be asynchronous, promoting efficient resource use in your applications.
  • LINQ Query Support: Leverage LINQ queries to fetch items based on complex predicates without dealing directly with SQL queries.
  • Partition Key Support: Direct support for partition keys to ensure optimal performance and scalability of your Cosmos DB operations.

Prerequisites

.NET SDK (version depending on your project requirements) Azure Cosmos DB account and setup completed

Usage

Below are examples of how to use the main features of Microsoft.Cosmo.Crud.Helper.

Initializing

To start using the package, initialize your Cosmos client and container csharp Copy code

var cosmosClient = new CosmosClient("YourConnectionString");
 var database = cosmosClient.GetDatabase("YourDatabaseName");
var container = database.GetContainer("YourContainerName"");
CosmoRepository<T> Service = new CosmoRepository<T>(container);

Replace T with your data model class.

Creating an Item

csharp Copy code

var item = new YourModel { /* Initialize your model properties */ };
await yourService.CreateItemAsync(item, "yourPartitionKey");

Getting an Item by ID

var item = await yourService.GetByIdAsync("yourItemId", "yourPartitionKey");

Updating an Item

item.SomeProperty = "New Value";
await yourService.UpdateItemAsync("yourItemId", item, "yourPartitionKey");

Deleting an Item

await yourService.DeleteItemAsync("yourItemId", "yourPartitionKey");

Querying Items

var items = await yourService.GetItemsAsync(x => x.SomeProperty == "SomeValue", "yourPartitionKey");

Getting All Items

Be cautious with GetAllItemsAsync in production environments, especially in large datasets, as it may impact performance.

var allItems = await yourService.GetAllItemsAsync();
Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.0 145 2/8/2024