AzureCosmoHelperCore 1.0.0
dotnet add package AzureCosmoHelperCore --version 1.0.0
NuGet\Install-Package AzureCosmoHelperCore -Version 1.0.0
<PackageReference Include="AzureCosmoHelperCore" Version="1.0.0" />
paket add AzureCosmoHelperCore --version 1.0.0
#r "nuget: AzureCosmoHelperCore, 1.0.0"
// 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
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 | Versions 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. |
-
net6.0
- Microsoft.Azure.Cosmos (>= 3.37.1)
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 |