azure-cosmos-dotnet-repository

Wraps the .NET SDK for Azure Cosmos DB abstracting away the complexity, exposing a simple CRUD-based repository pattern

MIT License

Stars
297
Committers
29

Bot releases are visible (Hide)

azure-cosmos-dotnet-repository - Release 2.6.0

Published by mumby0168 almost 3 years ago

What's Changed

New Contributors

Full Changelog: https://github.com/IEvangelist/azure-cosmos-dotnet-repository/compare/2.5.3...2.6.0

azure-cosmos-dotnet-repository - Release v2.5.3

Published by mumby0168 almost 3 years ago

azure-cosmos-dotnet-repository - Release v2.5.2

Published by IEvangelist almost 3 years ago

What's Changed

azure-cosmos-dotnet-repository - 2.5.1

Published by IEvangelist about 3 years ago

Overview

Nuget

This release fixed a bug, where the usage of managed identities were not functioning correctly.

New Contributors

azure-cosmos-dotnet-repository - 2.5.0

Published by mumby0168 about 3 years ago

Overview

Nuget

This release has focused on the configuration of the containers that the library creates for you, this library now offers more options in terms of throughput for a container, time to live at a container level and it can also apply updates via container syncing if you opt into it or you can call this manually yourself.

This release also adds a new API to the IRepository<TItem> implementation to see if an item exists or not based on its id or a predicate.

See the milestone here https://github.com/IEvangelist/azure-cosmos-dotnet-repository/milestone/1

Where to look

Here are a few locations where the samples have been updated to demonstrate the new APIs

Container Syncing is an opt-in feature and can have some performance impacts the first time your app starts up and makes a request to a given container as it will need to make sure the settings match what you have in your application. You can opt into this on a per-container basis or opt all containers in via the global setting which lives on the RepositoryOptions class. There is also a new service publicly available if you want to be in control of when to perform this container sync yourself the interface is named ICosmosContainerSyncService

Some Code Snippets

More Configuration & Container Syncing

class Startup : FunctionsStartup
{
    public override void Configure(IFunctionsHostBuilder builder) =>
        builder.Services.AddCosmosRepository(options =>
        {
            options.ContainerPerItemType = true;
            options.ContainerBuilder.Configure<User>(containerOptions => containerOptions
                .WithContainer("users")
                .WithPartitionKey("/emailAddress")
                .WithContainerDefaultTimeToLive(TimeSpan.FromMinutes(1))
                .WithManualThroughput(500)
                .WithSyncableContainerProperties()
            );
        });
}

Exists Async via Id

await _personRepository.ExistsAsync(person.Id);

Exists Async via Predicate

await _dogRepository.ExistsAsync(d => d.Breed == "cocker spaniel" || d.Id == dog3.Id);

Manual Container Syncing

await _syncService.SyncContainerPropertiesAsync<TestItem>();
azure-cosmos-dotnet-repository - 2.3.0

Published by mumby0168 about 3 years ago

Overview

This release has been the first release since a new set of maintainers have started working on the project. It has added an extra set of options for configuration as an alternative to use the attributes already provided & includes an in memory running option which can be great for running integration tests or just doing some little demos.

Where to look

We have a few sample project within this repository below are some links to the where the new features are used.

Some code snippets

Alternate Configuration

public override void Configure(IFunctionsHostBuilder builder) =>
            builder.Services.AddCosmosRepository(options =>
            {
                options.ContainerPerItemType = true;
                options.ContainerBuilder.Configure<User>(containerOptions => containerOptions
                    .WithContainer("users")
                    .WithPartitionKey("/emailAddress")
                );
            });

In Memory

services.AddInMemoryCosmosRepository();