Hi Robert,
In .NET 8, you can use SQLite by default instead of SQL Server by utilizing the command-line version of creating a project, which includes a SQLite database for Identity:
dotnet new blazor --name sample --auth Individual |
For more details, please refer to the Microsoft documentation: Secure ASP.NET Core server-side Blazor apps | Microsoft Learn.
However, as suggested in the following Stack Overflow post: https://stackoverflow.com/a/77644123, in an already created Blazor Web app targeting .NET 8 with Authentication, you can also delete the already created migration files for SQL Server and then follow the steps below to set up SQLite as database:
- Update the NuGet package: Remove the Microsoft.EntityFrameworkCore.SqlServer NuGet package from the current package manager and add the Microsoft.EntityFrameworkCore.Sqlite package.
- Modify the Program.cs file: Change the "options.UseSqlServer" in the Program.cs file to "options.UseSqlite".

- Modify the connection string in the AppSettings.json file: Set the connection string to "DataSource=<yourdbname>.db" (pointing to your SQLite database file).
- Run the following commands:
add-migration Update-Database |
Please
try the above and get back us if you need further assistance.
Regards,
Bharat Ram H