https://github.com/ewdlop/azurecosmosdbnoteapp
太空漫遊; Did you kids play with the Cosmos DB RU slider, and get you charge 6 figures in what platform?
https://github.com/ewdlop/azurecosmosdbnoteapp
azure-cosmosdb bulk-operation no-sql
Last synced: 7 months ago
JSON representation
太空漫遊; Did you kids play with the Cosmos DB RU slider, and get you charge 6 figures in what platform?
- Host: GitHub
- URL: https://github.com/ewdlop/azurecosmosdbnoteapp
- Owner: ewdlop
- License: mit
- Created: 2024-06-07T23:22:39.000Z (about 2 years ago)
- Default Branch: master
- Last Pushed: 2025-02-12T22:14:31.000Z (over 1 year ago)
- Last Synced: 2025-02-12T23:22:52.239Z (over 1 year ago)
- Topics: azure-cosmosdb, bulk-operation, no-sql
- Language: C#
- Homepage:
- Size: 96.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
- Security: SECURITY.md
Awesome Lists containing this project
README
# AzureCosmosDBNoteApp
```markdown
To Build the sln locally, please clone the following repository to your local machine.
(not submoduled)
Project Reference: https://github.com/ewdlop/CosmosDBPartialUpdateTypeConverter
#Client sideeeeeeeee
https://learn.microsoft.com/en-us/azure/cosmos-db/how-to-always-encrypted?tabs=dotnet
https://learn.microsoft.com/en-us/sql/relational-databases/security/encryption/always-encrypted-cryptography?view=sql-server-ver16#step-1-generating-the-initialization-vector-iv
https://www.ezpassnj.com/en/home/index.shtml <---shtml!?
https://en.wikipedia.org/wiki/Server_Side_Includes
https://learn.microsoft.com/en-us/sql/relational-databases/security/encryption/always-encrypted-cryptography?view=sql-server-ver16#step-1-generating-the-initialization-vector-iv
```
## Performance?
```markdown
https://learn.microsoft.com/en-us/azure/cosmos-db/nosql/materialized-views?tabs=azure-portal#Previewing
```
## 08/14/2024 Upate
```markdown
https://learn.microsoft.com/en-us/azure/cosmos-db/nosql/how-to-migrate-from-bulk-executor-library
```cs
BulkOperations bulkOperations = new BulkOperations(documentsToWorkWith.Count);
foreach (MyItem document in documentsToWorkWith)
{
document.operationCounter++;
bulkOperations.Tasks.Add(CaptureOperationResponse(container.ReplaceItemAsync(document, document.id, new PartitionKey(document.pk)), document));
}
```
```
private static async Task> CaptureOperationResponse(Task> task, T item)
{
try
{
ItemResponse response = await task;
return new OperationResponse()
{
Item = item,
IsSuccessful = true,
RequestUnitsConsumed = task.Result.RequestCharge
};
}
catch (Exception ex)
{
if (ex is CosmosException cosmosException)
{
return new OperationResponse()
{
Item = item,
RequestUnitsConsumed = cosmosException.RequestCharge,
IsSuccessful = false,
CosmosException = cosmosException
};
}
return new OperationResponse()
{
Item = item,
IsSuccessful = false,
CosmosException = ex
};
}
}
```
```cs
BulkOperations bulkOperations = new BulkOperations(documentsToWorkWith.Count);
foreach (MyItem document in documentsToWorkWith)
{
document.operationCounter++;
bulkOperations.Tasks.Add(CaptureOperationResponse(container.DeleteItemAsync(document.id, new PartitionKey(document.pk)), document));
}
```
# Session-State-and-Caching-Provider
https://learn.microsoft.com/en-us/azure/cosmos-db/nosql/session-state-and-caching-provider
```cs
public class MyBusinessClass
{
private readonly IDistributedCache cache;
public MyBusinessClass(IDistributedCache cache)
{
this.cache = cache;
}
public async Task SomeOperationAsync()
{
string someCachedValue = await this.cache.GetStringAsync("someKey");
/* Use the cache */
}
}
```
```cs
void captureDiagnostics(CosmosDiagnostics diagnostics)
{
if (diagnostics.GetClientElapsedTime() > SomePredefinedThresholdTime)
{
Console.WriteLine(diagnostics.ToString());
}
}
services.AddCosmosCache((CosmosCacheOptions cacheOptions) =>
{
cacheOptions.DiagnosticsHandler = captureDiagnostics;
/* other options */
});
```
## Also NOSQL
https://www.youtube.com/watch?v=D5xU7_98jWc

## geo-redundancy
## pusedo-Reference
> microsoft docs, course lectures, books, videos, by professionals
## Azure Cosmsdb Emulator is not free.