Prerequisites
Visual Studio 2019 v 16.4 or higher
Since Microsoft has marked .NET Core 3.0 as a 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 the latest versions of .NET Core in the future if any compatibility issues are found.
Introduction
Blazor is a new framework built by Microsoft for creating interactive client-side web UI with a .NET codebase. We can write both client-side and server-side code in C#.NET itself. I have already written seven articles about the Blazor server on C# Corner. Please refer to the below articles for more basics about the Blazor framework.
I have got a very good response for all the above articles. Hence, I decided to create a Visual Studio extension for the Blazor app with Entity Framework Core. So that, people can easily start with Blazor by downloading the extension and creating a Blazor app using a custom template.
I have provided the extension on Visual Studio Marketplace. You can also search the extension from Visual Studio Marketplace directly, using the “blazer” keyword.
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 it 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 the 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 the “Create” button to proceed.
I have already added the EF Core migration in the template to the project. No need to execute the “add-migration” command again.
You can simply execute the “update-database” command in the Package Manager Console to create a new database and table. If needed, you can change the SQL server name and database name in the “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 the Blazor Server app with Entity framework Core 3.1 and create an SPA for Employee with all CRUD actions within a minute. You only need to run the EF migration command to create a new database and table. Please download the extension from Visual Studio Marketplace and try it 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.