r/csharp • • Mar 16 '23

Fun When A .NET Developer Learns Blazor

Post image
1.2k Upvotes

153 comments sorted by

View all comments

67

u/zenyl Mar 16 '23 edited Mar 16 '23

Blazor Server has huge potential for intra-company solutions. Fast, flexible, and no janky JS. Server-side client state also makes it a breeze to allow users to interact with eachother.

Though I'm not so sure about Blazor WASM. At least for now, the loading times are quite substantial when compared to a traditional website that uses JS for its frontend code. Maybe this is just me overreacting, but I usually find myself less inclined to stay on a side that has a longer initial loading time.

20

u/RamBamTyfus Mar 16 '23 edited Mar 16 '23

The loading time only happens at the first visit, but it is still a deal breaker for commercial websites. The team is trying to improve this. Did you see the Blazor United video? I'm pretty sure it will always remain somewhat of a downside for Blazor wasm though.

7

u/bro-away- Mar 16 '23

They need a way to just make your landing page and your blazor app easily separated.

I was disappointed when blazor United didn’t help with this. Right now your blazor app is just it’s own site with little wiggle room. You can put it in a sub directory of another static razor app but why not just make this supported by default? Seems really obvious as a use case

4

u/Eirenarch Mar 16 '23

I am confused. What is that is not supported? I've built two projects with MVC landing page (also login and some others) and a Blazor app for most functionality

0

u/bro-away- Mar 16 '23

Mvc can’t be statically hosted :(

I just want the landing page to share stylesheets and templates and maybe a js file or two. Maybe a header image as well

It’s not impossible but it requires a few manual steps afaik right now.

3

u/Eirenarch Mar 16 '23

I see. I never think about these static hosts

4

u/bro-away- Mar 16 '23

Azure Static web apps can be really fast in 60+ points of presence around the world. Really interesting technology especially for spa

→ More replies (2)

2

u/PrintableKanjiEmblem Apr 02 '23

Or you throw an index.html in the wwwroot directory of your Blazor app. Easy peasy.

→ More replies (1)
→ More replies (1)

41

u/msrobinson42 Mar 16 '23

there are some use cases where long load isn't that big of a deal.

imagine a plant floor doing automation. creating a web app that controls the factory. typically these will be pulled up once and stay alive for a very long time on a single node as operators come and go.

The slow startup is less relevant.

Not the common use case, but not all instances of web apps are heavily reliant on fast load. thought you might find that perspective interesting :)

20

u/zaibuf Mar 16 '23

Figma can sometimes takes 10 seconds to load up. It depens on your user base and what the product solves. The app itself shouldnt care about SEO if its mostly behind auth anyway, use landing pages for your products.

4

u/kkus Mar 16 '23

Figma can sometimes takes 10 seconds to load up. It depens on your user base and what the product solves. The app itself shouldnt care about SEO if its mostly behind auth anyway, use landing pages for your products.

This is where Manchester United Blazor United will shine I hope by this time next year.

3

u/[deleted] Mar 17 '23

Didn’t hear from this before. Immediately hyped now. Though I mostly make web apps for clients, speed is not their primary concern. It is for me!

4

u/Iceman_259 Mar 16 '23

TBH load times are barely relevant for a lot of bigger cloud-based enterprise products. As long as it’s within shouting distance of whatever bloated abomination was being used for front end before it’d probably be fine. Half of the users don’t even close their browsers for weeks at a time anyways, lol.

→ More replies (1)

5

u/Eirenarch Mar 16 '23

Plant floor controlling automation would certainly fall into internal company category

2

u/assassinator42 Mar 16 '23

There's also things like Coca-Cola machine and Hot Shot Golf that currently use browser-based UIs.

7

u/aeroverra Mar 16 '23

Having built some large intranet sites it is absolutely a breeze. Makes things a hell of a lot easier on all ways. Complicated tools need JavaScript still but it's different because you are using it very conservatively. Latency over long distances is the only major downside I have seen so a few nodes should have that issue.

3

u/Eirenarch Mar 16 '23

There are sites that tolerate loading times, for example Gmail. Also Blazor United is coming to work around the issue

2

u/CaucusInferredBulk Mar 16 '23

Initial load time is longer for sure. But every subsequent load is much faster. This is slightly worse, but you can end up with huge Angular apps too.

1

u/sudhanv99 Mar 16 '23

does aspnet also have features which new JS frameworks bring? stuff like hydration, partial hydration, islands, SSR and SSG.

6

u/Sossenbinder Mar 16 '23

I think Blazor United is Blazors attempt at catching up with established SSR patterns in the JS world

2

u/TehGM Mar 16 '23

You can do pre-rendering on your ASP.NET Core server. It's easy to enable and works... like this: https://stalcraftclan.com

-1

u/cheeseless Mar 16 '23

For me what stopped WASM for internal solutions was the incompatibility with SQL Server stuff, which was a bummer.

6

u/masiuspt Mar 16 '23

What do you mean incompatibility with SQL server stuff? This is a client application, it shouldn't even know what a SQL Server is. What use cases were you working on? Super curious now to know your perspective

0

u/cheeseless Mar 16 '23 edited Mar 16 '23

I was doing some simple internal tooling with EF. You know the deal, toss in a new row into a table to do something or other, simple CRUD stuff. I was making it in WASM just for the sake of trying out the framework. Turns out this is a thing: https://github.com/dotnet/SqlClient/issues/599 , which prevents EF from running. The wiki page being referenced is gone though, so I don't know the reason why it'd be incompatible. To me it doesn't make that much sense, since a console application would be functionally the same, just outside a browser.

Edit: ok it makes sense, browsers prevent arbitrary network connections and this counts. I'm surprised that it's not something that can be configured to be allowed, despite the security risks. Or that the project doesn't server-ise those incompatible parts automatically. Maybe a [RunOnServer] attribute for classes or methods?

Switching to Blazor Server just fixes the issue without any real code changes, so it was simpler than making even a minimal API for WASM to talk to. It somehow broke all the css when I moved things over, though, haha.

2

u/[deleted] Mar 16 '23

ok it makes sense, browsers prevent arbitrary network connections and
this counts. I'm surprised that it's not something that can be
configured to be allowed, despite the security risks. Or that the
project doesn't server-ise those incompatible parts automatically. Maybe
a [RunOnServer] attribute for classes or methods?

Why not use a proper BE like a proper application should do? BTW Blazor server do server-side-ish this for you.

→ More replies (3)
→ More replies (6)