Visual Studio Extension For Blazor SPA With EF Core 3.1

Prerequisites


Visual Studio 2019 v 16.4 or higher
 
Since Microsoft has marked .NET Core 3.0 as maintenance release and 3.1 as LTS (long term support), I have made this Visual Studio extension with .NET Core 3.1. I will update this extension with latest versions of .NET Core in future, if any compatibility issues found.

Introduction


Blazor is a new framework built by Microsoft for creating interactive client-side web UI with .NET codebase. We can write both client-side and server-side code in C#.NET itself. I have already written seven articles about Blazor server on C# Corner. Please refer to below articles for more basics about Blazor framework.
I have got a very good response for all the above articles. Hence, I decided to create a Visual Studio extension for Blazor app with Entity framework Core. So that, people can easily start with Blazor by downloading the extension and create a Blazor app using custom template.
 
I have provided the extension on Visual Studio Marketplace. You can also search the extension from Visual Studio Market place directly, using “blazor” key word.
 
 
Please select the extension and download it.
 
 
 
You can download the extension from Visual Studio IDE also.
 
 
 
You will get a VSIX file if you download from Marketplace. If you try to download directly from IDE, your download will be scheduled and once you close the Visual Studio, your extension will be downloaded and added to the Visual Studio.
 
 
After successful installation, you can open Visual Studio 2019 and search with keyword “blazor”. You can also filter the project type by “Blazor”. I have added a project type tag Blazor for this extension.
 
 
 
You can give a valid file location for your project and click “Create” button to proceed.
 
 
 
I have already added the EF Core migration in the template to the project. No need to execute “add-migration” command again.
 
 
 
 
You can simply execute “update-database” command in Package Manager Console to create new database and table. If needed, you can change the SQL server name and database name in “appsettings.json” file.
 
 
 
That’s all.!!! Your Blazor SPA with EF Core is ready. You can run the application and see the landing page as shown below.
 
 
You can click the “Employee data” menu link and create a new Employee record.
 
 
 
You can modify or delete the Employee data as well.

Conclusion


In this post, I have explained how to download the Visual Studio extension for Blazor Server app with Entity framework Core 3.1 and create a SPA for Employee with all CRUD actions within a minute. You only need to run the EF migration command to create new database and table. Please download the extension from Visual Studio Marketplace and try from your side. If you really like this extension, please feel free to rate and give your valuable comments with your Microsoft account (You can sign in with other accounts also). Please feel free to contact me at any time for further clarifications and help.