ManagedCode.Database.AzureTables 2.0.1

The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org. Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
dotnet add package ManagedCode.Database.AzureTables --version 2.0.1
NuGet\Install-Package ManagedCode.Database.AzureTables -Version 2.0.1
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="ManagedCode.Database.AzureTables" Version="2.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add ManagedCode.Database.AzureTables --version 2.0.1
#r "nuget: ManagedCode.Database.AzureTables, 2.0.1"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install ManagedCode.Database.AzureTables as a Cake Addin
#addin nuget:?package=ManagedCode.Database.AzureTables&version=2.0.1

// Install ManagedCode.Database.AzureTables as a Cake Tool
#tool nuget:?package=ManagedCode.Database.AzureTables&version=2.0.1

img|300x200

Database

.NET Coverage Status nuget CodeQL

Version Package Description
NuGet Package ManagedCode.Database.Core Core
NuGet Package ManagedCode.Database.AzureTable AzureTable
NuGet Package ManagedCode.Database.CosmosDB CosmosDB
NuGet Package ManagedCode.Database.LiteDB LiteDB
NuGet Package ManagedCode.Database.MongoDB MongoDB
NuGet Package ManagedCode.Database.SQLite SQLite

OUTDATED--

Repository pattern implementation for C#.

A universal repository for working with multiple databases:

  • InMemory
  • Azure Tables
  • CosmosDB
  • LiteDB
  • SQLite
  • MSSQL
  • PostgreSQL

General concept

We 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. And do the same with the direct implementation.

// declare the model as a descendant of the base type.
public class SomeModel : IItem<T>
{

}
// then create an interface
public interface ISomeRepository : IRepository<TId, TItem> where TItem : IItem<TId>
{
}
// create a class inherited from a repository of the desired type
public class SomeRepository : BaseRepository<TId, TItem> where TItem : class, IItem<TId>, new()
{
}

And then add your interface and dependency configuration class.

services
        .AddTransient<ISomeRepository, SomeRepository>()

This is to define the id type, and the object itself.


Azure Table

// declare the model as a descendant of the base type.
public class SomeModel : AzureTableItem
{

}


// then create an interface
public interface ISomeRepository : IAzureTableRepository<SomeModel>
{
}


// create a class inherited from a repository of the desired type
public class SomeRepository : AzureTableRepository<SomeModel>, ISomeRepository
{
    public SomeRepository(ILogger<SomeRepository> logger, IConfiguration config) : base(logger, 
        new AzureTableRepositoryOptions
        {
            ConnectionString = "connectionString"
        })
    {
    }
}

CosmosDB

// declare the model as a descendant of the base type.
public class SomeModel : CosmosDbItem
{

}


// then create an interface
public interface ISomeRepository : ICosmosDbRepository<SomeModel>
{
}


// create a class inherited from a repository of the desired type
public class SomeRepository : CosmosDbRepository<SomeModel>, ISomeRepository
{
    public SomeRepository(ILogger<SomeRepository> logger, IConfiguration config) : base(logger, 
        new CosmosDbRepositoryOptions
        {
            ConnectionString = "connectionString"
        })
    {
    }
}

LiteDB

// declare the model as a descendant of the base type.
public class SomeModel : LiteDbItem<string>
{

}


// then create an interface
public interface ISomeRepository : ILiteDbRepository<string, SomeModel>
{
}


// create a class inherited from a repository of the desired type
public class SomeRepository : LiteDbRepository<SomeModel>, ISomeRepository
{
    public SomeRepository(ILogger<SomeRepository> logger, IConfiguration config) : base(logger, 
        new LiteDbRepositoryOptions
        {
            ConnectionString = "connectionString"
        })
    {
    }
}

MongoDB

// declare the model as a descendant of the base type.
public class SomeModel : MongoDbItem<string>
{

}


// then create an interface
public interface ISomeRepository : IMongoDbRepository<SomeModel>
{
}


// create a class inherited from a repository of the desired type
public class SomeRepository : MongoDbRepository<SomeModel>, ISomeRepository
{
    public SomeRepository(ILogger<SomeRepository> logger, IConfiguration config) : base(logger, 
        new LiteDbRepositoryOptions
        {
            ConnectionString = "connectionString"
        })
    {
    }
}

SQLite

// declare the model as a descendant of the base type.
public class SomeModel : SQLiteItem
{

}


// then create an interface
public interface ISomeRepository : ISQLiteRepository<string, SomeModel>
{
}


// create a class inherited from a repository of the desired type
public class SomeRepository : SQLiteRepository<SomeModel>, ISomeRepository
{
    public SomeRepository(ILogger<SomeRepository> logger, IConfiguration config) : base(logger, 
        new SQLiteRepositoryOptions
        {
            ConnectionString = "connectionString"
        })
    {
    }
}
Product Compatible and additional computed target framework versions.
.NET net7.0 is compatible.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
2.0.3 523 8/7/2023
2.0.2 502 4/18/2023
2.0.1 551 12/11/2022