Generate your ASP.NET Core application with JHipster.NET

Zenrac
2 min readMay 6, 2021

--

Introduction

JHipster is a well-known platform for generating modern application in java world.

JHipster provides a blueprints system that allows to override default behavior of the generator.

JHipster.NET

JHipster.NET is a blueprint that overrides the back-end part, originally generated in Spring Boot, with a back-end in ASP.NET Core. For the front-end all the base generator fronts are available (Angular, React, Vue.js) moreover you can also generate a Blazor or a Xamarin front.

Generate your first application

To install JHipster base generator and its JHipster.NET blueprint, run this command :

npm install -g generator-jhipster generator-jhipster-dotnetcore

Move to any empy folder you want to, and generate your full-stack app by running this command :

jhipster --blueprints dotnetcore

If everything goes as expected, you should have few question to answer. For instance, first questions will ask you to choose a base name, and a C# namespace. Once it’s done, you can build and run your application with this command :

dotnet run --verbosity normal --project ./src/YourAppName/YourAppName.csproj

Warning: Make sure to replace YouAppName with your actual real app name.

Moreover, if you have any difficulty, your generated application should contains a README.md that may help you quite a bit.

Entity generation

JHipster allow you to add entity with CLI or with JDL files
JHipster.NET have the same behavior. When creating a new entity in your database, your front-end is automatically updated to ensure a fully available management of all your entities.

Manual Entity Generation

To create an entity you can run the following command in your application folder:

jhipster entity <entity-name>

You will have to answer few more questions in order to decide if you want to add some relationship with other entities and if you want to add more fields to it.

JDL Entity Generation

You can also automaticaly generate many entities tanks to a JDL with the following command :

jhipster import-jdl my_file.jdl

A JDL (JHipster Domain Language) is a JHipster-specific domain language where you can describe all your applications, deployments, entities and their relationships in a single file (or more than one) with a user-friendly syntax.

You can create your JDL online on JDL Studio.

Conclusion

You have now an application with CRUD operations on each new entities with potentially link between entities (one-to-one, many-to-one or many-to-many)

Default configurations are availables in the generated project. As an example, a docker compose file is generated with monitoring solutions (InfluxDB Telegraf, Chronograf or Grafana). Here’s a sample project.

Feel free to contribute to JHipster.NET’s GitHub repository and don’t forget to put a star if you liked it.

--

--