Q&A's from "Building your first Blazor App"

ASP.NET Team Blog
06 March 2020
This week Carl Franklin, Julian and I hosted a packed out webinar "Building your first Blazor App". The response was overwhelming, so much so, some people could not get onto the live presentation. The entire thing was recorded and is available on our DevExpress YouTube Channel.
During the event, there were a lot of great questions raised, I'm going to provide a list of all the key ones below along with the answers. Don't forget, if you have a question relating to our Blazor components, the team are always available via the DevExpress Support Centre.

General

Q: Will there be another delivery channel for Blazor components other than NuGet?
A: Hello! At the moment we don't plan to use other channel except NuGet.
Q: Can Blazor access the DOM natively or does it require JavaScript trickery?
A: Carl will probably touch that, but no, Blazor / WASM cannot (yet) directly access the dom. But all the calculations are being done by C# and the actual updates on the DOM by JavaScript
Q: I like Blazor, but so far I've felt it's difficult to continue best practices in terms of writing code. I'm focusing on Blazor server side, and I want my code and views to be seperate, and I've had to fumble my way through getting things to work. It's also a different way of thinking about designing code. I'm used to the MVC pattern, and now I'm having to think in terms of creating modules, and that's been somewhat difficult for me. I also feel like If I'm creating components they should be reuseable and not-one off. Am I on the right track here?
A: With Blazor you cannot use the MVC design pattern, but you can actually use the MVVM design pattern in a really nice way. You can use DI to inject ViewModels etc. and then use the binding mechanism to bind to properties and methods on the ViewModel
Q: Are there any initiatives for using Blazor for Desktop applications?
Q: When will you have dashboard viewer?
A: It is in our todo list but we don't have an estimate for it yet.
Q: We're relying on the server-mode grids in win32 due to number of rows (100k+). Does the data grid handle same data amounts without issue?
A: Even more! Please check it on our online demo  https://demos.devexpress.com/Blazor/GridLargeDataBase
Q: Will Blazor have "design view" in VS2019 ? Where you can do drag-n-drop components visually?
A: Probably not
Q: Is it possible to encapsulate components in different assemblies and use them as a sort of library?
A: Absolutely, it's called a Razor component library. This works really nice but it's beyond the scope of this webinar
Q: Do you have plans to build HtmlEditor ?
A: I am afraid not in the near future. Should you have any other questions regarding our Blazor components, feel free to contact us at aspnetteam@devexpress.com
Q: Do the Nuget packages require authorization? I am asking because build/release pipelines will need to grab these.
A: If you're a registered customer, you will get a custom NuGet url which you can use for your build process
Q: When DevExpress does ship Blazor how similar will the controls be to the devExpress controls? (I.e. for migration)
A: We're working very hard on this. Please check our roadmap:  https://community.devexpress.com/blogs/aspnet/archive/2020/01/29/devexpress-Blazor-2020-roadmap.aspx. We want to implement most required components and features first. Unfortunately, we cannot implement all at once and must prioritize. If you have any specific requirements, I would love if you share them with our team at aspnetteam@devexpress.com or support@devexpress.com
Q: Can Blazor be added to an existing .Net Core app.
A: Yes
Q: How does the webpage know which UI components to update? For example if i had an onclick event that needed to update the values of multiple UI components how does it know to update those components
A: Well, that is one of the cornerstones of the Blazor technology. It has a virtual DOM and a very smart algorithm to determine which elements need to be updated
Q: Does Blazor catch compile time errors or will I still need to debug in say, Chrome Debugger?
A: Yes, Blazor will catch compile-time errors (to a certain extent)
Q: What is a a polyfill... we have customers that still use IE 11.
A: A polyfill is in most cases some JavaScript which will make certain features available in older browsers which would not support those features otherwise
Q: Lots of customers, especially government, still use IE11. Server side works fine with a polyfill. I have a website doing that right now, and works with IE11.
A: Absolutely, polyfills do a good job in that area!

App State

Q: If the connetion is lost, user can't see page and maybe server can loose SignalR connection too. This may end users session?
A: Yes, but generally what happens is that a new environment on the server will be setup. But since it's 'normal JavaScript/HTML' on the client you can use LocalStorage or SessionStorage on the client to maintain some sort of state to re-initialize the environment on the server.
Q: What are the size limitions on appState? For example if I want to have a huge grid that has no jitter .. and handle this by downloading a 400 MB data .. Can I do this ? or are we limited by the browser memory management?
A: The app runs in the same sort of sandbox as any JavaScript app (Angular/Vue/React etc.) so yes, you're limited to the browser's memory management
Q: If app state is persisted on the client what happens about multiuser?
A: In Carl's demo, this state will only be maintained for this user. It is maintained on that client

Client vs Server

Q: Using Blazor (client side), which is the best practice to handle different configurations for DEV/PROD environment? (example: api url)
A: You would probably need to configure different builds for DEV/PROD clients since you want the API endpoints hardcoded in the client. Remember it runs on the client's browser :-)
Q: When will WASM debugging be available in VS?
A: This one of the last things they are working on right now.
Q: Instead of writing inline server code with the @code tag, is there any way the code can be put in a code behind?
A: Yes there is, you can create a partial class FetchData { ... } in Carl's example FetchData.razor.cs in the same folder
Q: In MVC, I can update html code and refresh the page while running. Does Blazor have a way of doing this?
A: Yes there is this InvokeAsync(StateChanged) but the idea is to NOT use this (or the least possible). Blazor does an excellent job in updating the DOM where needed
Q: Is there a benefit of using server side Blazor over client side?
A: That depends on the specifications of your app. They both have pro's and con's. Right now the biggest disadvantage is that there is no debugging support for WASM. For server side Blazor, you need your clients to have rather good internet connection.
Q: Can we use Server-side and Client-side Blazor components in the same project? I am asking because each one of them has some pros and cons.
A: This is possible but not advisable
Q: Is client side ready for production yet?
A: It is expected to be 'baked' in May 2020, this means Microsoft should stop making breaking changes. There are people already using it but there is no official support from Microsoft yet so it's "no guts no glory" :-o in case of problems

SignalR / Hosting

Q: What is the scope now when using Blazor Server side with SignalR requests instead of http requests?
A: The DI scopes work slightly different from server / wasm. Check: https://docs.microsoft.com/en-us/aspnet/core/Blazor/dependency-injection?view=aspnetcore-3.1and look at Service Lifetime
Q: In client site Blazor can i use another server like node, java etc?
A: Yes, you can even use gRPC services running on whatever backend but gRPC for Blazor is still in beta
Q: Doesn't SignalR have limitations on concurrent connections? How is scalability being addressed with Blazor?
A: The amount of connections your server can handle depends greatly on the amount of RAM in your server(s). You can also scale up by using Azure SignalR hub
Q: This application is running on IIS Express, but can we host it on IIS server? will it work?
A: Absolutely! No problem at all!
Q: What do I do if I only allowed to host on-premise? I cannot scale-out to Azure for using Signal-R when using Server-side Blazor...
A: The performance of Server Blazor is pretty good: On Azure: 1 vCPU / 3.5 GB of RAM can accomodate over 5000 users, Standard D3 v2 (4vCPU, 14 GB of ram) can host 20,000 connections
Q: Regarding Azure again: my customer is actually not allowed (and even not possible due to network-restrictions) to use Azure. So ist there an on-premise alternative?
A: Azure is NOT required, you can run Blazor from a local IIS server quite happily.
Q: Doesn't the number of users / connections a server can support depend on the application size?
A: It depends primarily on the amount of RAM available on the server

XAF, XPO & Databases

Q: Do you already have any version of XAF using Blazor?
Q: Hi! Is it planed to implement Razor DevExpress Xaf in future?
A: Yes, please check the XAF roadmap on our site
Q: If I need XPO i am not able to use it because our ERP has a IBM i Power9 Plattform and you only have DB2 Drivers, but not DB2 on IBM i :/ Is there a plan for IBM i Database SUpport?
A: That depends on the maintainer of the database driver. But please contact our support for more details
Q: Is there an easy connection to MS SQL databases?
A: Well, clientside cannot connect directly, you will need to connect to some WebAPI or something. Serverside Blazor can directly connect with either EntityFramework or DevExpress XPO or you can roll your own data layer

Authentication

Q: Can we do authorization in client-side Blazor?
A: Absolutely, but right now, you need to do a bit of manual code. This will be tokenbased authentication. Check:  https://chrissainty.com/securing-your-Blazor-apps-authentication-with-clientside-Blazor-using-webapi-aspnet-core-identity/. Our new Blazor Server demo and tutorial should be of help as well – it is based on XAF's user authentication and group authorization APIs for .NET Core and .NET Framework apps
Q: Can we use the same security (roles etc) on serverside?
A: Yes, it works the same as MVC / WebAPI etc. with MS Identity

DevExtreme & Other Frameworks

Q: Hi, can we use DevExtreme in Blazor ?
A: You will need to use Blazor JavaScript interop to communicate
Q: Will we be able to port DevExpress controls to the Blazor version or will we need to develop from scratch?
A: You could use JavaScript Interop to use DevExtreme controls, but we're re-developing everything from scratch to be native Blazor controls.
Q: Can a Blazor application co-exist as a sub-module in AngularJS project?
A: Should be possible
Q: Can i use Vue-JS with Blazor
A: you can combine it in the same html page
Q: Is it possible to use third-party dlls in client-side Blazor apps (for sure they must be somehow running together with .NET Core)? What may I have to look for?
A: If those assemblies are .NET Standard 2.0 Dll's it will certainly work. But remember that your app runs in a similar sandbox as a 'normal' JavaScript app so you can't do anything more on the client as you could do with a JavaScript app
Q: How easy is it to use JavaScript frameworks like reactjs or vuejs with Blazor for say part of the application?
Q: How easy is it to use javascript frameworks like reactjs or vuejs with Blazor for say part of the application?
A: Javascript Interop is available with Blazor, but it might be quite tricky depending on your requirements
Q: Can we port Xamarin apps to this format?
A: There is a very early experiment from the Blazor team:  https://devblogs.microsoft.com/aspnet/mobile-Blazor-bindings-experiment/ this runs with Xamarin
Q: If we have a WPF using Dev Express, how easy to convert to Blazer?
A: Well, you have to re-do the UI Part; XAML != Blazor
Q: Hi, can we add WinForm controls in Blazor/WebAssembly application?
A: No
Q: Can you use .Net Core along with .Net(WinForm) together?
A: Well, our WinForms controls are compatible with .NET Core, but that's beyond the scope of this webinar
Q: Are there demos that show how to use this with an MVVM or MVC pattern, or is that question nonsense in these contexts?
A: There are demo's around, but we don;t have enough time in this webinar to touch it. Check this github repo at:  https://github.com/donwibier/DXBlazorSession
Q: I have legacy application (C++, MFC). Can I run my application using WebAssembly/Blazor with minimal changes? or do i need to re-write the whole code? I heard the beauty of webassembly is we can run existing windows application in brower using webassembly? If it is true, how can i run my existing legacy application in brower?
A: I guess this is question is not easy to answer, but be prepared for some serious development. Remember: Blazor runs on .NET Core, it's not compiled into WebAssembly. The only thing which is compiled into WebAssembly is the mono runtime which enables you to run .NET Standard dll's. Your code is compiled into intermediate .net code

Blazor Roadshow

Q: When is the Roadshow coming to Canada??? ...and bacon!!!!
A: Oh no! We don't have plans for Canada yet!!!
Q: When will Carl be in Germany?
A: We're looking at summer i think! visit  http://www.Blazorroadshow.com in the next couple months to see updates!

What’s New in v20.1

To explore the scope, breadth and capabilities of our new products/features, please visit: https://www.devexpress.com/Subscriptions/New-2020-1.xml.
3 comment(s)
MALTA
MALTA

Blazor vs ASP .NET core (DevExtreme ) vs Xamarin.  For me, a WinForm guy who desperately wants to move to platform-independent solution, feels lost.  Nowadays, it is not only a matter of deciding whether to run your application on a Linux/Max/Windows but now we have another 'new' comlication whether it is an x86 or ARM device!

If I had to re-write my application (or my next new project), to be any-mobile and any-laptop capable, which would I choose?  Bearing in mind that this app needs to work offline and then have some background thread that synchronises data between its local storage and the server.  Blazor seems to be a good competitor to Xamarin and maybe cheaper for a small business to develop applications? I'm getting the feel to go to Blazor, but it feels like it will end up like silverlight and flash.  On the other hand, having 15 years experience on winforms with a mature development code base and stable framework, it seems that nowadays you cannot bet on any web-framework.  These things seem to change from day to night.  Which one are you going to bet on?

10 March 2020
Daniel Hüttenberger
Daniel Hüttenberger
Full Ack. 
I‘m exactly in the same situation. 
Look at wisej. It‘s very easy and like winforms for Web. But documentation is Bad. 
13 March 2020
jdubeau
jdubeau
Awesome Paul!
26 March 2020

Please login or register to post comments.