{"id":19588932,"url":"https://github.com/managedcode/database","last_synced_at":"2026-02-27T13:35:43.514Z","repository":{"id":44922618,"uuid":"337426893","full_name":"managedcode/Database","owner":"managedcode","description":"Unified interface for working with a variety of different document-oriented NoSQL databases.","archived":false,"fork":false,"pushed_at":"2023-08-11T10:05:38.000Z","size":803,"stargazers_count":22,"open_issues_count":22,"forks_count":5,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-05-01T11:26:15.579Z","etag":null,"topics":["azure","cosmosdb","litedb","mongodb","mssql","postgresql","repository","sqlite","tables"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/managedcode.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-02-09T14:15:14.000Z","updated_at":"2023-06-12T15:36:22.000Z","dependencies_parsed_at":"2023-02-10T11:33:00.849Z","dependency_job_id":"2d778912-ab7a-4f96-83ff-3501f4aa1085","html_url":"https://github.com/managedcode/Database","commit_stats":null,"previous_names":["managed-code-hub/repository"],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/managedcode%2FDatabase","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/managedcode%2FDatabase/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/managedcode%2FDatabase/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/managedcode%2FDatabase/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/managedcode","download_url":"https://codeload.github.com/managedcode/Database/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224069367,"owners_count":17250456,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["azure","cosmosdb","litedb","mongodb","mssql","postgresql","repository","sqlite","tables"],"created_at":"2024-11-11T08:16:34.922Z","updated_at":"2026-02-27T13:35:43.455Z","avatar_url":"https://github.com/managedcode.png","language":"C#","readme":"![img|300x200](https://raw.githubusercontent.com/managed-code-hub/Database/main/logo.png)\n# Database\n[![.NET](https://github.com/managed-code-hub/Database/actions/workflows/dotnet.yml/badge.svg)](https://github.com/managed-code-hub/Database/actions/workflows/dotnet.yml)\n[![Coverage Status](https://coveralls.io/repos/github/managed-code-hub/Database/badge.svg?branch=main)](https://coveralls.io/github/managed-code-hub/Database?branch=main)\n[![nuget](https://github.com/managed-code-hub/Database/actions/workflows/nuget.yml/badge.svg?branch=main)](https://github.com/managed-code-hub/Database/actions/workflows/nuget.yml)\n[![CodeQL](https://github.com/managed-code-hub/Database/actions/workflows/codeql-analysis.yml/badge.svg?branch=main)](https://github.com/managed-code-hub/Database/actions/workflows/codeql-analysis.yml)\n\n| Version | Package | Description |\n| ------- | ------- | ----------- |\n|[![NuGet Package](https://img.shields.io/nuget/v/ManagedCode.Database.Core.svg)](https://www.nuget.org/packages/ManagedCode.Database.Core) | [ManagedCode.Database.Core](https://www.nuget.org/packages/ManagedCode.Database.Core) | Core |\n|[![NuGet Package](https://img.shields.io/nuget/v/ManagedCode.Database.AzureTables.svg)](https://www.nuget.org/packages/ManagedCode.Database.AzureTables) | [ManagedCode.Database.AzureTables](https://www.nuget.org/packages/ManagedCode.Database.AzureTable) | AzureTable |\n|[![NuGet Package](https://img.shields.io/nuget/v/ManagedCode.Database.Cosmos.svg)](https://www.nuget.org/packages/ManagedCode.Database.Cosmos) | [ManagedCode.Database.Cosmos](https://www.nuget.org/packages/ManagedCode.Database.Cosmos) | Cosmos DB |\n|[![NuGet Package](https://img.shields.io/nuget/v/ManagedCode.Database.LiteDB.svg)](https://www.nuget.org/packages/ManagedCode.Database.LiteDB) | [ManagedCode.Database.LiteDB](https://www.nuget.org/packages/ManagedCode.Database.LiteDB) | LiteDB |\n|[![NuGet Package](https://img.shields.io/nuget/v/ManagedCode.Database.MongoDB.svg)](https://www.nuget.org/packages/ManagedCode.Database.MongoDB) | [ManagedCode.Database.MongoDB](https://www.nuget.org/packages/ManagedCode.Database.MongoDB) | MongoDB |\n|[![NuGet Package](https://img.shields.io/nuget/v/ManagedCode.Database.SQLite.svg)](https://www.nuget.org/packages/ManagedCode.Database.SQLite) | [ManagedCode.Database.SQLite](https://www.nuget.org/packages/ManagedCode.Database.SQLite) | SQLite |\n---\n\n## Introduction\nThis library provides a unified interface for working with a variety of different document-oriented NoSQL databases. \nWith this library, you can easily switch between different databases without having to change your code,\nmaking it easy to experiment with different options and find the best solution for your needs.\n\n## Motivation\nDocument-oriented NoSQL databases are a popular choice for many applications because of their flexibility and ease of use. \nHowever, each database has its own unique syntax and features, making it difficult to switch between them. \nThis library aims to solve this problem by providing a consistent interface for working with multiple document-oriented NoSQL databases.\n\n## Features\n- Provides a single, unified interface for working with multiple document-oriented NoSQL databases.\n- Allows you to easily switch between different databases without having to change your code.\n- Makes it easy to experiment with different options and find the best solution for your needs.\n\n## Usage\n\nTo use the library, simply import it and initialize a client for the database you want to use. \n\n\n## Contributing\n\nWe welcome contributions to this project. If you have an idea for a new feature or improvement, please open an issue to discuss it. \nIf you want to submit a pull request, please make sure to follow the contribution guidelines and include tests for your changes.\n\n---\n# OUTDATED--\n## Repository pattern implementation for C#.\nA universal repository for working with multiple databases:\n- InMemory \n- Azure Tables\n- CosmosDB\n- LiteDB\n- SQLite\n- MSSQL\n- PostgreSQL\n\n## General concept\n\nWe don't think you can hide the real database completely behind abstractions, so I recommend using your interfaces that will lend IReposity of the right type.\nAnd do the same with the direct implementation.\n\n```cs\n// declare the model as a descendant of the base type.\npublic class SomeModel : IItem\u003cT\u003e\n{\n\n}\n```\n\n```cs \n// then create an interface\npublic interface ISomeRepository : IRepository\u003cTId, TItem\u003e where TItem : IItem\u003cTId\u003e\n{\n}\n```\n\n```cs \n// create a class inherited from a repository of the desired type\npublic class SomeRepository : BaseRepository\u003cTId, TItem\u003e where TItem : class, IItem\u003cTId\u003e, new()\n{\n}\n```\n\nAnd then add your interface and dependency configuration class.\n``` cs\nservices\n        .AddTransient\u003cISomeRepository, SomeRepository\u003e()\n```\nThis is to define the id type, and the object itself.\n\n---\n## Azure Table\n```cs\n// declare the model as a descendant of the base type.\npublic class SomeModel : AzureTableItem\n{\n\n}\n\n\n// then create an interface\npublic interface ISomeRepository : IAzureTableRepository\u003cSomeModel\u003e\n{\n}\n\n\n// create a class inherited from a repository of the desired type\npublic class SomeRepository : AzureTableRepository\u003cSomeModel\u003e, ISomeRepository\n{\n    public SomeRepository(ILogger\u003cSomeRepository\u003e logger, IConfiguration config) : base(logger, \n        new AzureTableRepositoryOptions\n        {\n            ConnectionString = \"connectionString\"\n        })\n    {\n    }\n}\n```\n---\n## CosmosDB\n```cs\n// declare the model as a descendant of the base type.\npublic class SomeModel : CosmosDbItem\n{\n\n}\n\n\n// then create an interface\npublic interface ISomeRepository : ICosmosDbRepository\u003cSomeModel\u003e\n{\n}\n\n\n// create a class inherited from a repository of the desired type\npublic class SomeRepository : CosmosDbRepository\u003cSomeModel\u003e, ISomeRepository\n{\n    public SomeRepository(ILogger\u003cSomeRepository\u003e logger, IConfiguration config) : base(logger, \n        new CosmosDbRepositoryOptions\n        {\n            ConnectionString = \"connectionString\"\n        })\n    {\n    }\n}\n```\n---\n## LiteDB\n```cs\n// declare the model as a descendant of the base type.\npublic class SomeModel : LiteDbItem\u003cstring\u003e\n{\n\n}\n\n\n// then create an interface\npublic interface ISomeRepository : ILiteDbRepository\u003cstring, SomeModel\u003e\n{\n}\n\n\n// create a class inherited from a repository of the desired type\npublic class SomeRepository : LiteDbRepository\u003cSomeModel\u003e, ISomeRepository\n{\n    public SomeRepository(ILogger\u003cSomeRepository\u003e logger, IConfiguration config) : base(logger, \n        new LiteDbRepositoryOptions\n        {\n            ConnectionString = \"connectionString\"\n        })\n    {\n    }\n}\n```\n---\n## MongoDB\n```cs\n// declare the model as a descendant of the base type.\npublic class SomeModel : MongoDbItem\u003cstring\u003e\n{\n\n}\n\n\n// then create an interface\npublic interface ISomeRepository : IMongoDbRepository\u003cSomeModel\u003e\n{\n}\n\n\n// create a class inherited from a repository of the desired type\npublic class SomeRepository : MongoDbRepository\u003cSomeModel\u003e, ISomeRepository\n{\n    public SomeRepository(ILogger\u003cSomeRepository\u003e logger, IConfiguration config) : base(logger, \n        new LiteDbRepositoryOptions\n        {\n            ConnectionString = \"connectionString\"\n        })\n    {\n    }\n}\n```\n---\n## SQLite\n```cs\n// declare the model as a descendant of the base type.\npublic class SomeModel : SQLiteItem\n{\n\n}\n\n\n// then create an interface\npublic interface ISomeRepository : ISQLiteRepository\u003cstring, SomeModel\u003e\n{\n}\n\n\n// create a class inherited from a repository of the desired type\npublic class SomeRepository : SQLiteRepository\u003cSomeModel\u003e, ISomeRepository\n{\n    public SomeRepository(ILogger\u003cSomeRepository\u003e logger, IConfiguration config) : base(logger, \n        new SQLiteRepositoryOptions\n        {\n            ConnectionString = \"connectionString\"\n        })\n    {\n    }\n}\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmanagedcode%2Fdatabase","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmanagedcode%2Fdatabase","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmanagedcode%2Fdatabase/lists"}