JCTools.GenericCrud 2.0.0-beta1

.NET Core 2.1
This is a prerelease version of JCTools.GenericCrud.
There is a newer version of this package available.
See the version list below for details.
dotnet add package JCTools.GenericCrud --version 2.0.0-beta1
NuGet\Install-Package JCTools.GenericCrud -Version 2.0.0-beta1
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="JCTools.GenericCrud" Version="2.0.0-beta1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add JCTools.GenericCrud --version 2.0.0-beta1
#r "nuget: JCTools.GenericCrud, 2.0.0-beta1"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install JCTools.GenericCrud as a Cake Addin
#addin nuget:?package=JCTools.GenericCrud&version=2.0.0-beta1&prerelease

// Install JCTools.GenericCrud as a Cake Tool
#tool nuget:?package=JCTools.GenericCrud&version=2.0.0-beta1&prerelease


Simplification of the Create, Read, Update and Delete web pages of the application models.


All application required multiple pages for edited the base models. This pages generally are equals to each other.

This package allows reduce this task at minimum of actions.

You only require create and configure your models, and this package create the necessary controllers, views and actions for the Create, Read, Update and Delete actions.




.net core 2.1

.net core 2.1

The bootstrap v4.0.0 and highers are unsupported


  1. Add the package to your application
Install-Package JCTools.GenericCrud -Version 2.0.0


dotnet add package JCTools.GenericCrud --version 2.0.0
  1. Add the next lines in the method ConfigureServices of your Startup class
    services.ConfigureGenericCrud<MyContext>(o =>
        // Indicate if desired use Modals 
        o.UseModals = true;
        // add the models type to manage with the package
        o.Models.Add<Models.Movie, int, MovieController, Data.Context>();

Note: From the version 2.0.0 the next features was marked how to obsolete and will be removed in future versions: - The method o.Models.Add(Type modelType, string keyPropertyName = "Id", string controllerName = ""). - The ContextCreator option

  1. Add the next line in the UseMvc middleware call, this in the method Configure of your Startup class

     Your code should see similar to the next code

   app.UseMvc(routes =>
       routes.MapCrudRoutes(); // add this line
           name: "default",
           template: "{controller=Home}/{action=Index}/{id?}");

  1. Run to app and access at the url http://localhost:5000/[ModelName], sample: http://localhost:5000/Country. In the browser you should see a similar page to : Sample index page

Custom controllers

If your desired personalize your controllers, add additional actions or override the default actions, then

  1. Not add the model to manage in the step 3 of the last section
  2. Create a new controller the inherits from JCTools.GenericCrud.Controllers.GenericController<TDbContext, TModel, TKey>. sample
using System;
using JCTools.GenericCrud.Controllers;
using JCTools.GenericCrud.Services;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Localization;
using Microsoft.Extensions.Logging;

namespace Test.Controllers
    public class MovieController : GenericController<Data.Context, Models.Movie, int>
        public MovieController(IServiceProvider serviceProvider) 
        : base(serviceProvider)
            // Add your custom process, eg;
            Settings.UseModals = false;
  1. (optional) If you override the OnActionExecuting(ActionExecutingContext filterContext) or OnActionExecutionAsync(ActionExecutingContext context, ActionExecutionDelegate next) controller methods, make sure to invoke the base methods for the correct initializations of the controller settings
    public override void OnActionExecuting(ActionExecutingContext filterContext)
        // Add your custom process here

    public override Task OnActionExecutionAsync(ActionExecutingContext context, ActionExecutionDelegate next)
        // Add your custom process here
        return base.OnActionExecutionAsync(context, next);
  1. Run to app and access at the url http://localhost:5000/Movie,

Changes of the version 2.0.0

  • The follows interfaces was replaced for a best definition and structure:
    • IBase → IViewModel
    • IBaseDetails, ICrudDetails → IDetailsModel
    • ICrudEdit → IEditModel
    • ICrudList → IIndexModel
  • The follows models was replaced by the CrudModel class
    • Base
    • CrudDetails
    • CrudEdit
    • CrudList
  • The IControllerOptions interface and ControllerOptions class was removed for being unnecessary in the new structure
  • The extensors methods GetLocalizedString(...) for the IStringLocalizer interfaces was moved to the StringLocalizerExtensors class


MIT License

Product Versions
.NET net5.0 net5.0-windows net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows net7.0 net7.0-android net7.0-ios net7.0-maccatalyst net7.0-macos net7.0-tvos net7.0-windows
.NET Core netcoreapp2.1 netcoreapp2.2 netcoreapp3.0 netcoreapp3.1
Compatible target framework(s)
Additional computed target framework(s)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.2.1 266 3/14/2021
2.2.0 225 2/2/2021
2.1.0 235 1/19/2021
2.1.0-beta1 235 1/10/2021
2.0.0 253 1/9/2021
2.0.0-beta4 217 1/6/2021
2.0.0-beta2 167 1/4/2021
2.0.0-beta1 212 12/27/2020
1.0.5 854 5/11/2018 897 5/8/2018 907 5/8/2018
1.0.4 847 5/7/2018
1.0.3 866 5/6/2018
1.0.2 873 4/19/2018
1.0.1 903 4/13/2018
1.0.0 887 3/19/2018