Skip to content

Freysi21/Shotgun

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Shotgun

Shotgun NuGet Version

A .NET library that makes it easier to create beautiful, cross platform, webapi applications.
It is heavily inspired by REST

Table of Contents

  1. Features
  2. Installing
  3. Documentation
  4. Examples

Features

  • Supports CRUD operation on all entities within a given dbContext
  • Filtering
  • Paging
  • Exporting

Installing

The fastest way of getting started using Shotgun is to install the NuGet package.

dotnet add package Shotgun

Documentation

So you done did scaffolded a table with entity framework and you wanna make it available via http? Hoot nany lemme help ya out. After running

dotnet ef scaffold "somedb" -t SomeTable

Change the generated code for the table to

public class SomeTable : IEntity<int>
{
 public override int Id {get; set}
}

If your pk is not named Id change it to ID in the class and update the dbcontext model mapping to refrence the sql pk name. Next create the repo

public class SomeTableRepository : ShotgunRepo<SomeDbContext, SomeTable, int>
{
}

Next create the controller

public class SomeTableController: Shotgun<SomeTableRepository, SomeTable, int>
{
}

Also in your program.cs you need to dependency inject SomeDbContext, SomeTableRepository.

After all this you should have some of the more common functionality from a REST API for sometable. If you want to remove some of the features you can just override the controller endpoints or just use the repository in your own controller.

Examples

TODO

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages