Blazor - AAU-Dat/P3-Code-Bookingsystem GitHub Wiki
Blazor
interactive UI with c#
Blazor lets you build interactive web UIs using C# instead of JavaScript. Blazor apps are composed of reusable web UI components implemented using C#, HTML, and CSS. Both client and server code is written in C#, allowing you to share code and libraries.
Run on WebAssembly or the server
Blazor can run your client-side C# code directly in the browser, using WebAssembly. Because it's real .NET running on WebAssembly, you can re-use code and libraries from server-side parts of your application.
Alternatively, Blazor can run your client logic on the server. Client UI events are sent back to the server using SignalR - a real-time messaging framework. Once execution completes, the required UI changes are sent to the client and merged into the DOM.
Built on open web standards
Blazor uses open web standards without plug-ins or code transpilation. Transpilation is the process of converting code written in one programming language to another. Transpilation to JavaScript is a common approach to enabling languages to run in the browser, but often provides limited functionality. Blazor works in all modern web browsers, including mobile browsers.
Code running in the browser executes in the same security sandbox as JavaScript frameworks. Blazor code executing on the server has the flexibility to do anything you would normally do on the server, such as connecting directly to a database.
Share code and libraries
Blazor apps can use existing .NET libraries, thanks to .NET Standard—a formal specification of .NET APIs that are common across all .NET implementations.
.NET Standard allows the same code and libraries to be used on the server, in the browser, or anywhere you write .NET code.
JavaScript interop
Your C# code can easily call JavaScript APIs and libraries. You can continue to use the large ecosystem of JavaScript libraries that exist for client side UI while writing your logic in C#.
When using server-side code execution, Blazor takes care of seamlessly executing any JavaScript code on the client.
Kilde/download side for Blazor
Blazor webassembly vs Blazor server
Blazor webassembly
Pros
- True SPA (single page application), full interactivity
- Utilizr client resources
- Supports offline, static sites, PWA (Progressive web application) scenarios
Cons
- Larger download size
- Requires webassembly
- Still in preview
May 2020
Blasor Server
Pros
- Smaller downloadsize, faster load time
- Running on fully featured .NET runtime
- Code never leaves the server
- Simplified architectur
Cons
- Latency
- No offline support
- Consumes more server resources
.NET Core 3.0
vi skal tage et valg her :)