Microsoft Visual Studio 2022 Blazor Web App template and .Net 8 with rendering. Database access and rendering has been for me a tricky one.

Timo Kinnunen 126 Reputation points
2024-05-06T15:12:28.11+00:00

Microsoft Visual Studio 2022 Blazor Web App template and .Net 8 with rendering.

Database access and rendering has been for me a tricky one.

And I may give back a little to community making this GitHub repository public.

SimpleBookCatalogWithControllers

https://github.com/TimoKinnunen/SimpleBookCatalogWithControllers

Here is a simple Book Catalog (as shown by CodeGanesh) using controllers (as shown by Patrick God). Database is SQLite.

Create a new project in Visual Studio and choose Blazor Web App, .Net 8, Auto (Server and WebAssembly).

Add a new project of type Library.

Add HttpClient both on server side and client side.

BookService.cs is different on server side and client side.

Register services on server and client side.

Install Design, Sqlite, Tools on server side.

Helpful videos of Entity Framework Core in .NET 8 on YouTube:

https://www.youtube.com/watch?v=w8imy7LT9zY&t=3190s by Patrick God. Thank you.

https://www.youtube.com/watch?v=jw-udNnMgaE&t=10s by CodeGanesh. Thank you.

With helpful regards Timo Kinnunen

Blazor
Blazor
A free and open-source web framework that enables developers to create web apps using C# and HTML being developed by Microsoft.
1,411 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Zhi Lv - MSFT 32,036 Reputation points Microsoft Vendor
    2024-05-10T02:56:54.15+00:00

    Hi @Timo Kinnunen

    Microsoft Visual Studio 2022 Blazor Web App template and .Net 8 with rendering. Database access and rendering has been for me a tricky one.

    Microsoft official document also has some tutorials about the Database access and data rendering, and it also provide some sample code, you can refer to them:

    For Database Access, you can use Entity Framework Core: ASP.NET Core Blazor with Entity Framework Core (EF Core) and View or download sample code.

    For the data rendering, you can use Blazor Form Components or Razor Tag Helper to display the data, and you can also use the QuickGrid component to display data in tabular form (see the QuickGrid for Blazor sample app).


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    Best regards,

    Dillion

    0 comments No comments