All Projects → IEvangelist → azure-cosmos-dotnet-repository

IEvangelist / azure-cosmos-dotnet-repository

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

Programming Languages

C#
18002 projects

Projects that are alternatives of or similar to azure-cosmos-dotnet-repository

ionic4-angular8-crud-mobileapps-example
Ionic 4 Angular 8 Tutorial: Learn to Build CRUD Mobile Apps
Stars: ✭ 20 (-89.47%)
Mutual labels:  crud
crudlfap
MIRROR of yourlabs.io/oss/crudlfap
Stars: ✭ 20 (-89.47%)
Mutual labels:  crud
rust-realworld-example-app
Example Rust codebase containing real world examples (CRUD, auth, advanced patterns, etc) that adheres to the RealWorld API spec.
Stars: ✭ 19 (-90%)
Mutual labels:  crud
boiler-plate-commands
Package to generate automatic cruds for Laravel BoilerPlate Apps
Stars: ✭ 13 (-93.16%)
Mutual labels:  crud
nodejs-simple-restfull-with-express
⚡ ExpressJS Rest API Sample
Stars: ✭ 19 (-90%)
Mutual labels:  crud
dapper-repositories
CRUD for Dapper
Stars: ✭ 523 (+175.26%)
Mutual labels:  crud
MoviesApp
A Movie Application uses TheMovie API, MVVM architecture and all jetpack components.
Stars: ✭ 100 (-47.37%)
Mutual labels:  repository-pattern
GraphQL.RepoDB
A set of extensions for working with HotChocolate GraphQL and Database access with micro-orms such as RepoDb (or Dapper). This extension pack provides access to key elements such as Selections/Projections, Sort arguments, & Paging arguments in a significantly simplified facade so this logic can be leveraged in the Serivces/Repositories that enca…
Stars: ✭ 25 (-86.84%)
Mutual labels:  repository-pattern
GithubApp-android-architecture
Let's learn a deep look at the Android architecture
Stars: ✭ 16 (-91.58%)
Mutual labels:  repository-pattern
mongo-crud
CRUD API built with MongoDB and Express
Stars: ✭ 18 (-90.53%)
Mutual labels:  crud
eloquent-repository
Repository pattern for Eloquent ORM with focus in cache.
Stars: ✭ 30 (-84.21%)
Mutual labels:  repository-pattern
now-cms
No description or website provided.
Stars: ✭ 15 (-92.11%)
Mutual labels:  crud
spring-boot-mongodb-react-java-crud
Spring Boot, MongoDB and React.js CRUD Java Web Application Example
Stars: ✭ 33 (-82.63%)
Mutual labels:  crud
Preference-Rhythm
Android library makes using Shared Preference easier.
Stars: ✭ 16 (-91.58%)
Mutual labels:  repository-pattern
todo-list
A practical web application built with Node.js, Express, and MySQL for you to readily record, view, and manage your tasks with an account: Create, view, edit, delete, filter, and sort expenses are as easy as pie 🥧
Stars: ✭ 18 (-90.53%)
Mutual labels:  crud
android-base-project
Android LateralView Base Project
Stars: ✭ 25 (-86.84%)
Mutual labels:  repository-pattern
SimplePHP
A small query builder project designed to assist daily routines and speed up the process of communicating with the database.
Stars: ✭ 14 (-92.63%)
Mutual labels:  crud
mvc
PHP MVC boilerplate with user authentication, basic security and MySQL CRUD operations.
Stars: ✭ 28 (-85.26%)
Mutual labels:  crud
laravel-realworld-example-app
Exemplary RealWorld backend API built with Laravel PHP framework.
Stars: ✭ 34 (-82.11%)
Mutual labels:  crud
movies
An example approach for modularization, reactive clean architecture and persistancy.
Stars: ✭ 110 (-42.11%)
Mutual labels:  repository-pattern

build CodeQL NuGet .NET code metrics Discord

All Contributors

Azure Cosmos DB Repository .NET SDK

This package wraps the NuGet: Microsoft.Azure.Cosmos package, exposing a simple dependency-injection enabled IRepository<T> interface.

Stats

Alt

Documentation

The core library IEvangelist.Azure.CosmosRepository and IEvangelist.Azure.CosmosEventSourcing both host there own documentation site. See below:

Cosmos Repository

The repository is responsible for all of the create, read, update, and delete (CRUD) operations on objects where T : Item. The Item type adds several properties, one which is a globally unique identifier defined as:

[JsonProperty("id")]
public string Id { get; set; } = Guid.NewGuid().ToString();

Additionally, a type property exists which indicates the subclass name (this is used for filtering implicitly on your behalf):

[JsonProperty("type")]
public string Type { get; set; }

Finally, a partition key property is used internally to manage partitioning on your behalf. This can optionally be overridden on an item per item basis.

📣 Azure Cosmos DB - Official Blog

Getting started

  1. Create an Azure Cosmos DB SQL resource.

  2. Obtain the resource connection string from the Keys blade, be sure to get a connection string and not the key - these are different. The connection string is a compound key and endpoint URL.

  3. Call AddCosmosRepository:

    public void ConfigureServices(IServiceCollection services)
    {
        services.AddCosmosRepository();
    }

    The optional setupAction allows consumers to manually configure the RepositoryOptions object:

    public void ConfigureServices(IServiceCollection services)
    {
        services.AddCosmosRepository(
            options =>
            {
                options.CosmosConnectionString = "< connection string >";
                options.ContainerId = "data-store";
                options.DatabaseId = "samples";
            });
    }
  4. Define your object graph, objects must inherit Item, for example:

    using Microsoft.Azure.CosmosRepository;
    
    public class Person : Item
    {
        public string FirstName { get; set; }
        public string LastName { get; set; }
    }
  5. Ask for an instance of IRepository<TItem>, in this case the TItem is Person:

    using Microsoft.Azure.CosmosRepository;
    
    public class Consumer
    {
        readonly IRepository<Person> _repository;
    
        public Consumer(IRepository<Person> repository) =>
            _repository = repository;
    
        // Use the repo...
    }
  6. Perform any of the operations on the _repository instance, create Person records, update them, read them, or delete.

  7. Enjoy!

Samples

Visit the Microsoft.Azure.CosmosRepository.Samples directory for samples on how to use the library with:

Deep-dive video

A deep dive into the Azure Cosmos DB repository pattern NET SDK

Cosmos Repository Crash Course

Discord

Get extra support on our dedicated Discord channel.

alt Join the conversation

Contributors

Thanks goes to these wonderful people (emoji key):


David Pine

💻 ⚠️ 💡 👀

Invvard

⚠️ 💻

Richard Mercer

💻

Daniel Marbach

💻

Manuel Sidler

💻

Dave Brock

📖 💻

Cagdas Erman Afacan

💻 💡

dcuccia

💻

VeryCautious

💻 ⚠️

Billy Mumby

💻 📖 🤔

Michael Zhang

🤔 💻

Shay Rojansky

👀

Junior Macedo

💻 🤔

Emre KARA

💻

Brad Westness

👀

Matt Stannett

💻 📖 ⚠️

mustafarabie

💻 ⚠️

Robert Bennett

⚠️ 💻

Rabosa616

💻 ⚠️ 📖

Adam Storr

💻 ⚠️

Kevin Benton

💻 ⚠️

Filip Persson

💻 ⚠️

A.F.M. Noorullah

📖

This project follows the all-contributors specification. Contributions of any kind welcome!

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].