This tutorial assumes that you have:
- Registered with a valid email address and confirmed your account using the validation email sent to your address
- Downloaded and installed the CodeGenHero extension for Visual Studio 2022
- Know how to run a couple of database scripts using tools such as SQL Server Object Explorer (available in Visual Studio) or SQL Server Management Studio (SSMS)
Prepare the Database
Let's take a moment to create a sample database with some data. CodeGenHero uses database schema to scaffold out create, read, update, and delete (CRUD) operations. A sample "ArtistSite" schema is provided for use with this tutorial, but you may alternatively choose use your own, existing, relational database.
Using SQL Server Object Explorer (SSOE)
In Visual Studio, click View | SQL Server Object Explorer.
You should see a connection to "(localdb)\MSSQLLocalDB". If you do not see this connection, click the 'Add SQL Server' icon and add it.
In the opened SQL Server Object Explorer pane, right-click on the entry (localdb)\MSSQLLocalDB and then
select New Query to open a SQL query tab and verify the connection is working.
- Open the ArtistSite_Schema.sql file (not ArtistSite_SampleData.sql) unzipped in a previous step using the File | Open | File menu command, the Ctrl + O keyboard shortcut, or by drag-and-drop onto the SQLQuery1.sql tab opened in the previous step.
Once open, execute the script by clicking the green arrow in the top-left corner of the tab.
Alternatively, use the Ctrl + Shift + E keyboard shortcut to run the script.
This may open a Connection Dialog before performing execution. If this happens, enter "(localdb)\MSSQLLocalDB" as your server, and select Windows Authentication.
Visual Studio's SSOE dialog and SQL tabs sometimes have difficulty with mouse input at high display resolutions.
If this happens to you, move the dialog to another monitor, use the Ctrl + Shift + E keyboard shortcut, or use the Tab key to navigate.
Right-click the Databases folder under LocalDB and click the Refresh icon. You should see a new ArtistSite database that looks similar to the following image.
- Run the second ArtistSite_SampleData.sql script to populate this new ArtistSite database with sample data.
(Optional) Prepare Azure Active Directory
If you are using the Azure Active Directory project template, you will need to set up an Azure Active Directory tenant and register your applications which will be used for your Blazor application.
Detailed instructions for registering an application with Azure Active Directory can be found here.