DevExpress DevExtreme ASP.NET Core CRUD Application

DevExpress has been providing UI components since 1998 and have won many awards year in year out. They can be counted amongst the top component publishers like Telerik, Infragistics, etc. Their DevExtreme component suite has won the Visual Studio Magazine Readers Choice Best Cross-Platform suite for the past 3 years.

CodeStencil just released a stencil that targets this same DevExtreme family of components, and this stencil gives you the ability to generate a complete working application with full CRUD capabilities.  It was inspired by a demo realeased some weeks ago on YouTube showing how to easily implement the DevExtreme Grid in a Razor application, See:  

This stencil will generate models, razor pages, services, controllers, etc. The good thing is that you have full control and configuration on how the code is generated, so you do not end up with a lot of redundant code.

You can see the full video of this blog see:


So, let's get into it.

If you do not have CodeStencil installed, you can download and install a free/trial copy from Downloads.


By default, CodeStencil has the Quick Start Wizard loaded at startup. Once this dialog is loaded, clicking NEXT will take you to the  "Add Project Name, Select Stencil" page. This shows some stencils downloaded and listed by default.


Unfortunately, you will not see the DevExtreme Grid Stencil listed because it is not downloaded by default and you need a DevExpress license to be able to use it. This is by design;  there is no point automatically downloading 3rd party stencils unless you have a license for the corresponding product. You can get a trial version here.

Close/Cancel the Quick Startup wizard.


Now we proceed...

Step 1: Download the DevExtreme Grid Stencil.

From Stencils | Manage Stencils:

You will see the "Manage Stencils" dialog pop-up. Under the list of "Online" stencils, select the DevExpress category, under 3rd Party, Select "DevExtremeAspCore" Click Install.



Step 2: Create a new project

Accept the default name = "Project1"

Click on the stencil icon to select the DevExtreme stencil:

The "Select Stencil" dialog opens. Follow the numbered steps:

1 - Select the DevExpress category

2 - Select the "DevExtremeAspCore" stencil

3 - Click the "Select" button

After the stencil has been selected we are returned to the New Project form. Note the following:

A - The "DevExtremeAspCore.codestencil" stencil has been selected.

B - Note the output folder for the generated code. This can be changed at any time.


Step 3: Code Generation

Click on the Generate button:



Once the code is generated you will be prompted to navigate to the output folder. Click "No" to close this prompt.

Next, highlight/select the node : [%PROJECT_NAME%].sln; Right-Click for the context menu, Select the menu item - "Load File using Registered Application";  This will open the solution in a new copy of Visual Studio.


Run the application. You will see the generated DevExtreme ASP.NET Core application with all the tables from the Chinook Database

So what is the big deal here?

You may be thinking, what is the big deal, this is just another code generator and now you will have to start deleting redundant code you do not need. Consider the following:

CRUD Features: Your grid is automatically enhanced with CRUD capabilities without you writing any line of code. The stencil will pick the tables you selected before code generation and build the models, controllers, and razor pages to support this.


Time Saver: This entire application was generated in just about 27 seconds.

  1. Think about how long it would have taken to code the razor pages, controllers,  etc. by hand.  



If you can generate between 60-70% of clean and concise code that you have control over, that is huge!




Continue reading
  1547 Hits

Syncfusion Blazor Grid Stencil

Syncfusion has been providing UI components since 2001 and can be counted amongst the top component publishers like DevExpress, Telerik, Infragistics, etc. So it is no surprise to see them push out Blazor components to complement this new Microsoft Technology.

CodeStencil now has a stencil to help Syncfusion developers generate all the necessary code to kick off a Blazor project - The Syncfusion Blazor Grid Stencil.

This stencil will generate models, razor pages, services, controllers, etc. The good thing is that you have full control and configuration on how the code is generated, so you do not end up with a lot of redundant code you have to start deleting.

So, let's see how this is done.

If you do not have CodeStencil installed, you can download and install a free/trial copy from Downloads.

Continue reading
  3377 Hits

ASP .NET Razor Stencil Released.

The new ASP .NET Razor Stencil will generate a fully working web application based on razor pages.


This stencil was created from the Contoso University tutorial on Razor Pages with Entity Framework Core. You can recreate an entire application based on your own database in less than 5 mins without writing a single line of code!

You can watch this to see how this is done

Continue reading
  3373 Hits


This stencil is based on the article - Developing Great Web APIs Architectures w/ ASP.NET Core 2.1 given by Chris Woodruff at QCon.

The design is based on the following and uses very good standard practices:

  • Single Responsibility Principle simplifies implementation and design
  • The Ports and Adapter Pattern decouples business logic from other dependencies
  • Decoupled architecture makes testing much easier and more robust

This stencil will generate the same code used in this presentation. However, the beauty of stencils in CodeStencil is that you can swap and use your own database, define the name of your project, namespaces, etc. and the generated code will automatically use these.

The solution and all code from this article's examples can be found here in Chris' GitHub repository ChinookASPNETCoreAPIHex.

The stencil for this example can be downloaded from here: WebApi on github

Continue reading
  5910 Hits

CodeStencil - Another app to add to your tool chest

Another application to add to your tool chest CodeStencil comes with a new approach to code generation. Even though there are a lot of tools and libraries out there being used today for code generation and scaffolding, once you have an output it isn't easy to reconfigure and have a do over without complicated changes to the original scripts/templat...

Continue reading
  1276 Hits

What is CodeStencil?

I have always been a firm believer of the saying.. "Do not reinvent the wheel". So, I am always looking for ways to speed up or cut out repetitive tasks.

The concept of CodeStencil is simple... string replacement.

CodeStencil is simply an IDE that helps you intelligently use existing code to build a stencil (or in familiar terms - a Template) that can be used to generate the same code, again, but at the same time allowing you to define the strings to replace.

From the screenshot below, NAMESPACE will be replaced by "Dolasoft" during code generation:

Unlike standard code generators, you do not need to learn a template language. If you do not want to build your Stencil from scratch, you can create it within minutes from already generated code. 

Continue reading
  1334 Hits
Instant SSL Pro