GitHub - KorzhCom/EasyData: An open-source framework for quick and easy implementation of CRUD operations (both API and UI) in ASP.NET Core applications.

github.com
6 min read
fairly easy
An open-source framework for quick and easy implementation of CRUD operations (both API and UI) in ASP.NET Core applications. - GitHub - KorzhCom/EasyData: An open-source framework for quick and ea...
EasyData

Build .NET Build JS Nuget Npm

About

EasyData library lets you quickly build a UI for CRUD (Create, Read, Update, Delete) operations in any ASP.NET Core application that uses Entity Framework Core.

Basically, EasyData does the following two things:

First, it "reads" your DbContext object in order to obtain the necessary metadata.

Then, based on that metadata, it provides an API endpoint for all CRUD operations and renders the UI (pages and dialogs) that communicate with the API endpoint for data-management tasks.

The real advantage here is that whenever you change something in your DbContext (add a new DbSet or a property in the model class), the UI automatically adjusts to those changes.

So, as you can see, EasyData can be very useful for quick prototyping of any database-related ASP.NET Core project. In just minutes you'll have a working web app with all CRUD forms for your database.

Quick demo

Getting started

First of all, to test EasyData you can open and run one of the sample projects available in this repository.

Installing EasyData to your own project takes the following 3 simple steps:

1. Install EasyData NuGet packages

EasyData.AspNetCore

EasyData.EntityFrameworkCore.Relational

2. Add EasyData middleware in Startup.Configure

using EasyData . Services ; . . . . . app . UseEndpoints ( endpoints => { endpoints . MapEasyData ( options => { options . UseDbContext < AppDbContext >(); }); endpoints . MapRazorPages (); });

In the middleware options we also specify the type of DbContext object that will be used as the source of the metadata.

3. Set up a catch-all page for all CRUD operations

If you're using Razor Pages, add a new page (for example EasyData.chstml ). If it's MVC, you'll need a controller and a view. This page will "catch" all URLs that begin with a certain prefix ( /easydata by default but it's configurable). So, we use a special catch-all parameter in the route definition ( "/easydata/{**entity}" ).

We also add…
Read full article