JJMasterData is an open-source .NET library to help you create CRUDs quickly from data dictionaries (database metadata), along with other boilerplate-intensive things like exporting and importing data.
- Complete CRUD operations ✅
- Pages generated at runtime ✅
- Data export & import ✅
- Hangfire support ✅
- Database script generation ✅
- IronPython support ✅
- Bootstrap 3,4 & 5 support ✅
- Log interface ✅
- Test library ✅
This tutorial assumes you will use .NET 6+, for .NET Framework 4.8 support, check our documentation.
Installing JJMasterData.Web, will install all required dependencies.
In your configuration file (normally appsettings.json), add a SQL Server connection string. Support for more DBMSs is planned.
Add the following lines to your Program.cs
//This line will add JJMasterData required services.
builder.Services.AddJJMasterDataWeb();
//Add this line before specifing your default route. It will use the required services and add the RCL routes.
app.UseJJMasterDataWeb();
Add the following lines to your _Layout.cshtml
<partial name="_MasterDataStylesheets"/>
<partial name="_MasterDataScripts"/>
<partial name="_MasterDataTheme"/>
IMPORTANT: If you have Bootstrap and jQuery installed, remove it from your _Layout.cshtml both CSS and JS, JJMasterData already have Bootstrap and jQuery installed. You can choose Bootstrap 3, 4 and 5 using JJMasterDataSettings. If you really want to use your own Bootstrap or jQuery files or CDNs, check _MasterDataStylesheets and _MasterDataScripts source code and specify all dependencies except Bootstrap.
In your preferred database-tool like Azure Data Studio or SSMS, create the following example table:
-- Create a new table called '[Person]' in schema '[dbo]'
-- Drop the table if it already exists
IF OBJECT_ID('[dbo].[Person]', 'U') IS NOT NULL
DROP TABLE [dbo].[Person]
GO
-- Create the table in the specified schema
CREATE TABLE [dbo].[Person]
(
[Id] INT NOT NULL PRIMARY KEY IDENTITY,
[FirstName] NVARCHAR(50) NOT NULL,
[Age] INT NOT NULL
-- Specify more columns here
);
GO
Next, run your website and open in your browser the route /en-us/DataDictionary, you will be presented with the following screen:
After clicking on "Next", click on "Add"
Enter the table name (Person), checking the option "Import Fields", after that, you will have a representation of your metadata.
Click on "Get Scripts" and then "Run Stored Procedures"
After running the Stored Procedures Scripts, click on Preview, and you will have your CRUD with nearly zero code 🪄
JJFormView is the class responsible to render all JJMasterData CRUDs. It have many features out of the box like filters, data exportation and a huge customization potential using .NET code, you can even inject Python code in your application at runtime. You have 2 options to instantiate a JJFormView:
- Using the /DataDictionary/Render/{dictionaryName} route
- Creating a View or Page instantiating a JJFormView
For customization you have a lot of scenarios too:
- Using the DataDictionary Web interface, we have lots of options, we don't have everything documented yet, but you can help submitting a PR
- Using the IFormEvent interface (recommended), check the docs for more information
- Customizing your own JJFormView object at your pages (the old school way of the JJ Consulting team in the WebForms era, not recommended)
JJMasterData is production-ready and is already being used by JJConsulting customers.
Have a bug or a feature request?
Please first search for existing and closed issues.
If your problem or idea is not addressed yet, please open a new issue.