Simple documentation for Blazor?

baylf2000

Member
Joined
Jan 7, 2023
Messages
9
Programming Experience
10+
I'm new to C#, although I have a lot of experience in C++, Python, PHP etc.

I have the need to create a simple windows application that presents a very basic web interface to the user, pulling data from a local sqlite database. People have suggested using Blazor Server, however I've spent three days going through dozens of tutorial from both Microsoft and others and have ended up giving up on each and every one, usually because of what seems to be significant version differences in the tutorial and the currently available.

I've found a few downloadable example projects, however these all contain huge numbers of files and code to do something as simple as present a basic todo list, and trying to work out what the thing is doing without documentation is extremely difficult.

I'm hoping someone here can recommend some basic tutorials that are up to date with the current releases and show how to get a basic CRUD example up.

Please and thank you!
 
If you want to create a Windows application, why are you looking at Blazor which is a web based application?
 
So you don't have to create a Windows application. You have to create a web application. Or are trying to say that the backend has to use a Windows OS, but the front end has to be a web application?
 
Anyway, consider that Blazor is still relatively young and still rapidly changing. This is why a lot of the information for it is disjointed. Another thing is that it builds on other existing technologies, so it assumes that you already know Razor, the ASP.NET WebAPI, SignalR, etc.
 
Presumably you've tried the MS tutorials?
 
Install VS2022

New project

Blazor Server template

Choose stuff like the name, net version, whether to use top level statements, and an identity probider

Make the project, run it

-

Now you want to add a DB?

Install EF Core Power Tools

Obtain your existing SQLite db (or create one; it really is the path of least resistance)

Use EFCPT to Reverse Engineer the DB (right click the project, EFCPT>Reverse)

Read up on what to do with EF core contexts in Blazor server; we don't inject them like we might otherwise but instead we either inject a context factory and ask it to make a connection when one is required, or we make a new one with the "new" key wordwhere it is needed
-

Get used to the way Blazor works; you don't try and pull the text out of a TextBox, you bind a textbox's value to a string property and then get/set the property to read/write the TextBox

-

Post up your SQLite db and I'll make you a starter project that searches and edits records from one of the tables. Mostly you can ask ChatGPT to write it for you with questions like "I have a db table called People with the following columns: Name Varchar, Age int, Birthday datetime. Please create me a c# class to represent the table, an EF context that will read and write it to/from a SQLite database, and a Blazor razor page with controls for each of the properties that will ask for user input and call on the EF context to save it"
 
So you don't have to create a Windows application. You have to create a web application. Or are trying to say that the backend has to use a Windows OS, but the front end has to be a web application?

I apologise for my poor explanation, but I'm not sure how else to clarify it. I need to create an installable windows application with an embedded web server that presents a web interface to users rather than a traditional WinForm or WPF interface. From what I have been told, I can do this with Blazor Server. The application would still present a single WinForm or WPF window which would only have only the information the user needs to connect to the web interface.
 
Last edited:
What's the reason behind making it web-flavored then? Typically we eg make a winforms app because the app will be installed on a powerful desktop and one person will use it. Typically we make a web app because it will be installed on a powerful server and multiple people will use it. It's an unusual use case to install a web app on a powerful desktop for one person to use, though it's by no means impossible..

..but really I think you're looking at two apps; one a Blazor server app that manifests your todo list, and the other a winforms app that basically reads the config file for the server app and tells the user what url it finds in there, and maybe also starts the web app and offers a clicky link to open a browser so the user can use it. There would be ways to ditch that and just have a shortcut on the desktop that opens a web browser pointing at the web app
 
WPF offers web like navigation if that is the reason for looks for a web app to run on desktop app:


If the reason why someone is asking for a web like UI on a desktop app is that they have the mistaken belief that creating a web app is easier or less complex than creating a Windows app, they need to be dissuaded of that belief. Things actually get more complex if you need to create a web server AND a web browser that is self-contained.

Or was the requirement that something use Electron or some other framework that lets you have a web like framework to work in so that in the future other devs can just drop in othr4 components designed for the web to just (hopefully) work?
 
I think we're getting a little of topic here? :)

I really appreciate all the excellent thoughts, however I don't want to go into exact details. I am a C++ programmer, not a web developer, so I have no desire to create web apps instead of winform apps. As I've said several times already, this situation requires a simple web interface rather than a winforms interface.

My original question was about advice on finding some simple and up-to-date resources on Blazor Server usage.
 
I think the ChatGPT idea was an excellent suggestion. Just using your example exactly as you wrote it gave me the basic example code I needed to better understand the framework. I never thought I'd use AI to help explain a programming task to me!
 
I am a C++ programmer, not a web developer, so I have no desire to create web apps instead of winform apps.
By choosing to use Blazor, you are going down that road of creating a web app. You could could created a WinForms or WPF or WinUI app and avoided the web app. It's possible to skin that latter 2 to make the controls look like they were web controls.

Anyway, I'm glad you found a way to understand Blazor better with some AI generated code.
 
By choosing to use Blazor, you are going down that road of creating a web app. You could could created a WinForms or WPF or WinUI app and avoided the web app. It's possible to skin that latter 2 to make the controls look like they were web controls.

Anyway, I'm glad you found a way to understand Blazor better with some AI generated code.

Yes, I do understand that. I think it would be charitable of people to not assume that someone is a complete moron or they that know nothing about anything simply because they ask a specific question on a specific topic. Perhaps just doing your best to answer their very specific question instead of trying to grill them on their entire project is enough?

I understand that all your kind and generous efforts on a site like this may lead you to a somewhat jaded view of the intelligence or experience levels of the average person, however sometimes a person may just not wish to discuss the details of their project beyond what they already have.
 
Last edited:
I think we're getting a little of topic here? :)
In any question/answer session one needs to make the answerers aware enough of what the requirements are, and right now we don't really understand enough of the use case to give good answers because the request seems odd

We could just operate at your insistence, but then we're providing implementation advice to a spec you've designed even though you've admitted you're not really well experienced enough in this particular subject area to do the design

Help us understand so we can advise better; we only ask questions to fill in what we think are the gaps in our knowledge needed to get to a minimum level of understanding of what is necessary.. I.e. we ask because we need the answers, not "for the good of our health" :)
 

Latest posts

Back
Top Bottom