New in Blazor with some rookie questions

180 Views Asked by At

I'm new in Blazor, and i want to create a PWA to work (almost) full offline.

The user must Authenticate (Microsoft.AspNetCore.Authentication).

Then i need to get some data from SQL Server and store it in the browser LocalStorage.

After that, all the work is done with the local data, and only when finnished its necessary to send to SQL Server.

What is the best way to achieve this?

  • Configure for HTTPS, ASP.NET Core hosted and Progressive Web Application
  • Only Configure for HTTPS and Progressive Web Application

I already have the SQL Database, so i think i will try to do the EF Core Power Tools - Reverse Engineer.

What is the best "architecture" to accomplish this? Cliente, Server and Shared? Cliente, Lib, DataContext, API?

Thank you in advanced for any guidance.

3

There are 3 best solutions below

0
On BEST ANSWER

I created a project with:

  • None Authentication type
  • Configure for HTTPS
  • ASP.NET Core hosted
  • Progressive Web Application

Printscreen1 This way i manage to get what i wanted.

My Client project as this packages: Client

My Server project as this packages: Server

And in my Shared project i only have my classes (created like the SQL Database Tables i will use).

After that, i get records from the SQL and stored them in the localstorage. Then, i only use localstorage to work. In the end, i (will) submit the data to SQL Server.

I toke a look at leandro-toloza and ibrahim comments and links (which I am grateful for) to solve my question.

PS: I will try to keep you informed about the project's progress (difficulties and achievements).

0
On

I can suggest you use an amazing Project in Github called BlazorWithIdentity

It is a good starting point as boilerplate for a blazor wasm hosted app using cookie based authentication with ef core identity. It will save your time and frustation and you will learn a lot from it. Demo

You can then add PWA to it easily by following the documentation on how to convert blazor wasm to PWA explained at this link:

https://learn.microsoft.com/en-us/aspnet/core/blazor/progressive-web-app?view=aspnetcore-6.0&tabs=visual-studio#convert-an-existing-blazor-webassembly-app-into-a-pwa

0
On

first i want to share Microsoft Official Documentation about this topic, it would help you to develop a PWA with Blazor.

Configure https + asp.net core hosted (you need it for Blazor)

And refering to the "Architecture", beign simple, Client (WASM). It would be pointless to create a server side application and then add PWA features. Think that you run simultaneously the app offline and on server side.