Skip to content

evanirla/snacks-entity-core

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Snacks.Entity.Core

Snacks.Entity.Core is a .NET Core framework that aims to simplify the relationship between the database and the public-facing REST API.

Installation

Use the NuGet package manager to install the latest version of Snacks.Entity.Core

Install-Package Snacks.Entity.Core

Usage

Create an entity service

using System;
using Snacks.Entity.Core;

public class StudentService : EntityServiceBase<StudentModel, MyDbContext>
{
    public StudentService(
        IServiceScopeFactory scopeFactory) : base(scopeFactory) { }
}

Create an entity controller

using System;
using Microsoft.Extensions.DependencyInjection;
using Snacks.Entity.Core;

public class StudentController : EntityControllerBase<StudentModel>
{
    public StudentController(
        IServiceProvider serviceProvider) : base(serviceProvider) { }
}

Register entity services

In your Startup.cs file, add the entity services in the ConfigureServices method.

using Snacks.Entity.Core;

public void ConfigureServices(IServiceCollection services)
{
    services.AddDbContext<MyDbContext>();
    services.AddEntityServices();
}

Test

Your application should now allow you to query data RESTfully like api/students?grade[gte]=5&orderby[desc]=age&offset=5&limit=20

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

License

MIT © Irla Software Solutions

About

Delicious extensions for EF Core

Resources

License

Code of conduct

Stars

Watchers

Forks

Languages