Skip to content

A library based on EF Core, for development using Azure Tables is more productive.

Notifications You must be signed in to change notification settings

matheusvelloso/fakeorm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

47 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

.NET Build Status

A library based on EF Core, for development using Azure Tables is more productive. Click here to report bug or request feature.

Install

PM> Install-Package FakeOrm.AzureTables -Version 1.0.5

Configuration

public class Startup
{
   public IConfiguration Configuration { get; }

   public void ConfigureServices(IServiceCollection services)
   {
     services.UseAzureTablesRepository(Configuration);
     //OR
     services.UseAzureTablesRepository(Configuration.GetConnectionString("AzureTableConnection"));
   }
}

In appsettings.json:

{
  "ConnectionStrings": {
    "AzureTableConnection": "DefaultEndpointsProtocol=https;AccountName=**************;AccountKey=*********;EndpointSuffix=core.windows.net"
  }
}

Usage

using FakeOrm.AzureTables.Domain;

namespace YourWorkspace.YourAwesomeClass
{
    //inherit from 'BaseEntity'
    public class User : BaseEntity
    {
    	//public constructor without parameters is required
        public User() { }
    }
}
using FakeOrm.AzureTables.Repository.Interface;

namespace YourWorkspace.YourAwesomeClass
{
    [ApiController]
    [Route("[controller]")]
    public class UserController : ControllerBase
    {
        private readonly IAzureTableRepository<User> _repository;

        public UserController(IAzureTableRepository<User> repository)
        {
            _repository = repository;
        }

        [HttpPost]
        public async Task<IActionResult> Post()
        {
            var user = new User() { };

            await _repository.CreateOrUpdateAsync(user);

            return Ok();
        }
    }
}

About

A library based on EF Core, for development using Azure Tables is more productive.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages