Skip to content

Generate REST API from entity context #537

Open
@Kaliumhexacyanoferrat

Description

@Kaliumhexacyanoferrat

As a developer of a web application, I would like to expose an existing entity context as an API so that I do not have to write typical boiler code and can spin up a new API even faster.

Example

public class MyContext : DbContext
{

    public DbSet<MyType> MyTypes { get; set; }

}

var app = Entities.From<MyContext>()
                  .AddOpenApi();

Host.Create()
    .Handler(app)
    .Run();

Acceptance criteria

  • The feature is implemented in a new module (or even GitHub repository)
  • DbContext instances can either be created using a parameterless constructor or via a factory method
  • Entities are automatically exposed via REST
  • Entities can be filtered, paged etc.
  • The logic reuses the MethodCollection capabilities for the sake of simplicity
  • The feature is compatible with the Open API module (meaning that its content can be discovered)
  • Authorization can be applied on entity/method level (probably another issue as this is also relevant for all of the other frameworks)
  • The feature is documented as a framework on the GenHTTP website
  • There is a project template for this kind of project
  • The feature is covered by acceptance tests

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions