Blazor

Blazor
Original author(s)Microsoft
Developer(s).NET Foundation
Initial release2018; 6 years ago (2018)
Repositorygithub.com/dotnet/aspnetcore/tree/main/src/Components
Operating systemLinux, macOS, Windows
Included withASP.NET Core
TypeWeb framework
LicenseApache License 2.0
Websitedotnet.microsoft.com/en-us/apps/aspnet/web-apps/blazor

Blazor is a free and open-source web framework that enables developers to create web user interfaces (UI) based on components, using C# and HTML.[1][2][3][4][5] It is being developed by Microsoft, as part of the ASP.NET Core web app framework.

Blazor can be used to develop single-page, mobile, or server-rendered applications using .NET technologies.

History

In 2017, at NDC Oslo, Steve Sanderson, Software engineer at Microsoft, unveiled[6] an experimental client-side web application framework for .NET that he called "Blazor". The demo involved an interactive app running in the browser using WebAssembly, and a rudimentary development experience in Visual Studio. Sanderson demonstrated how to build interactive components using C# and Razor syntax. The app was then compiled to .NET assemblies that were running on a lightweight third-party open-source .NET runtime, called DotNetAnywhere, that had been compiled to WebAssembly.

The name, "Blazor", as explained by Steve Sanderson, is a portmanteau of the words "Browser" and "Razor". (from the Razor syntax being used)

Blazor got admitted as an official open-source project by Microsoft, and in 2018, as part of .NET Core 3.1, Blazor Server was released to the public. It enabled server-driven interactive web app that update the client browser via WebSockets. Shortly thereafter, Blazor WebAssembly was released. Unlike the prototype, it used the Mono .NET runtime on WebAssembly. This is the same runtime that is used for developing mobile apps with .NET MAUI (previously Xamarin).

The Blazor source code was first located in its own repository on GitHub, until it was merged into the ASP.NET Core monorepo. The development has been carried out from there ever since.

With the release of .NET 5, Blazor has stopped working on Internet Explorer and the legacy version of Microsoft Edge.[7]

In 2023, with .NET 8, Blazor on the server underwent some fundamental changes[8] to enable server-side rendered (SSR) pages that are not fundamentally interactive, allowing Blazor to be used as an alternative to MVC Razor Pages. With this change, developers can opt-in per component (or page) whether it should be interactive, and whether it should run on the server or in the browser using WebAssembly. These are referred to as Interactive "Render modes".

Components

Components are formally referred to as Razor components.

A Razor component consists mainly of HTML that is mixed with Razor templating syntax that enables the inline-use of C# to influence the rendering.

The Blazor component model makes sure that the rendered markup gets updated when the state of the component changes, usually in response to user action.

While both markup and C# code can be placed in the same .razor file, it is also possible to have a separate code-behind file with a partial class.

Components are compiled into .NET classes. The HTML and Razor markup of a component gets translated into code that builds a render tree that then drives the actual rendering.

Example

The following example shows how to implement a simple counter that can be incremented by clicking a button:

<h1>Counter</h1>

<p>Count: @count</p>

<button @onclick="Increment">Increment</button>

@code 
{
    private int count = 0;

    private void Increment()
    {
        count++;
    }
}

Hosting models

Blazor apps can be hosted in multiple ways. These are the hosting models as of .NET 8.

Blazor Web app (Server)

A server-hosted Blazor app, as part of an ASP.NET Core app.

Static server-side rendering (SSR)

By default, components are rendered by the server as static HTML, without any interactivity. Interactivity can be enabled per component by setting a render mode.

This is equivalent to how MVC views and Razor Pages are rendered.

Render modes

Source:[9]

In .NET 8, Blazor introduced the concept of render modes which configure whether Razor components are interactive and what drives that interactivity.

The render mode is inherited within a component hierarchy, from its top most parent component that has a set render mode. This can not be overridden by child components, unless its render mode is the default Static Server.

  • Static Server – The component is rendered statically on the server with no interactivity. This is the default.
  • Interactive Server – The component is running on the server in interactive mode. The interactivity is server-driven and changes are pushed to the client over WebSocket, using SignalR.
  • Interactive WebAssembly – The component is running in interactive mode in the browser using WebAssembly.
  • Interactive Auto – This will initially load the component in the Interactive Server render mode while the Blazor bundle is downloaded. On subsequent visits Interactive WebAssembly is used on the client.

Prerendering

Interactive components is pre-rendered on the server before being materialized on the client and interactivity kicking in. This behavior is turned on by default, but can be turned off.

Enhanced navigation

This feature makes navigation on a static site much smoother in a way that feels like a Single Page application (SPA).

When navigating from one static page to another, the app intercepts the navigation, retrieving just the content of the target page, and then apply only the changes to the DOM. That way the page doesn't flicker as it usually does when being completely reloaded upon navigating to another page.

WebAssembly (Standalone)

This is a standalone interactive WebAssembly app running in the client browser.

Upon navigating to the app in a browser, the app bundle get downloaded, then loaded and executed within the browser's sandbox.

A WebAssembly app can also be made into a Progressive web app (PWA).

Prior to .NET 8, there was a project template in which a Blazor WebAssembly app was hosted within an ASP.NET Core application containing Web APIs. This was removed in favor of the Blazor Web app project template, although the functionality still remains.

Hybrid

Allows Blazor apps to run within a native app using a WebView.[10] Rendering is performed in the hosting process, without a web server.

Hybrid apps can be hosted in Windows Presentation Foundation or WinForms application.

This approach is used for building native mobile apps with Blazor, using .NET MAUI.

Server (Legacy)

The intended use was to enable server-driven interactive components, with changes being sent out to the client using WebSockets.

A component was rendered within a MVC Razor Page.

It also enabled prerendering of WebAssembly components.

This hosting model was formally referred to as "Blazor Server".

It has been deprecated in favor of Blazor Web app.

See also

References

  1. ^ Strahl, Rick (31 July 2018). "Web Assembly and Blazor: Re-assembling the Web". Rick Strahl's Weblog. Self-published. Archived from the original on 22 October 2018.
  2. ^ Tomassetti, Federico (September 4, 2018). "Blazor: .NET in the Browser". tomassetti.me. Strumenta. Archived from the original on 22 October 2018.
  3. ^ James, Mike (12 February 2018). "Blazor .NET In The Browser". i-programmer.info. Self-published. Archived from the original on 2018-02-18.
  4. ^ Miller, Jonathan (September 2018). "C# in the Browser with Blazor". MSDN Magazine. 33 (9). Archived from the original on 22 October 2018.
  5. ^ Roth, Daniel (22 March 2018). "Get started building .NET web apps that run in the browser with Blazor". ASP.NET Blog. Microsoft. Archived from the original on 2019-04-30.
  6. ^ "Web Apps can't really do *that*, can they? - Steve Sanderson". YouTube. 2017-07-10. Retrieved 2024-02-28.
  7. ^ Roth, Daniel (30 September 2020). "Updated Blazor browser support for .NET 5". dotnet/aspnetcore repo. Microsoft – via GitHub.com.
  8. ^ "ASP.NET Core Blazor fundamentals". 2024-12-02. Retrieved 2024-02-28.
  9. ^ "ASP.NET Core Blazor render modes". 2024-02-09. Retrieved 2024-03-26.
  10. ^ "ASP.NET Core Blazor Hybrid". Retrieved 2023-11-14.

Further reading

  • Engström, Jimmy (2021). Web Development with Blazor: A hands-on guide for .NET developers to build interactive UIs with C#. Packt Publishing. ISBN 978-1800208728.
  • Himschoot, Peter (2021). Microsoft Blazor: Building Web Applications in .NET 6 and Beyond. Apress. ISBN 978-1484278444.
  • Wright, Toi (2021). Blazor WebAssembly by Example: A project-based guide to building web apps with .NET, Blazor WebAssembly, and C#. Packt Publishing. ISBN 978-1800567511.
  • Sainty, Chris (2022). Blazor in Action. Manning Publications. ISBN 978-1617298646.

Read other articles:

Artikel ini perlu diwikifikasi agar memenuhi standar kualitas Wikipedia. Anda dapat memberikan bantuan berupa penambahan pranala dalam, atau dengan merapikan tata letak dari artikel ini. Untuk keterangan lebih lanjut, klik [tampil] di bagian kanan. Mengganti markah HTML dengan markah wiki bila dimungkinkan. Tambahkan pranala wiki. Bila dirasa perlu, buatlah pautan ke artikel wiki lainnya dengan cara menambahkan [[ dan ]] pada kata yang bersangkutan (lihat WP:LINK untuk keterangan lebih lanjut...

 

 

Peta yang menunjukkan letak Siayan Siayan adalah munisipalitas di provinsi Zamboanga del Norte, Filipina. Secara politis Siayan terbagi atas 22 barangay. Balok Balunokan Datagan Denoyan Diongan Domogok Dumpilas Gonayen Guibo Gunyan Litolet Macasing Mangilay Moyo Muñoz Pange Paranglumba (Pob.) Polayo Sayaw Seriac Siayan Proper (Pob.) Soguilon Pranala luar Philippine Standard Geographic Code Diarsipkan 2012-04-13 di Wayback Machine. 2000 Philippine Census Information lbs Provinsi Zamboanga del...

 

 

SMA Negeri 15 BandungInformasiDidirikan1 Juli 1982[1]AkreditasiA[2]Nomor Statistik Sekolah301026001001Nomor Pokok Sekolah Nasional20219238Kepala SekolahToto Suharya, S.Pd., M.Pd.Jurusan atau peminatanIPA, IPS dan BahasaRentang kelasX-1 s.d. X-12 (Kurikulum Merdeka), XI-1 s.d. XI-12 (Kurikulum Merdeka), XII IPA, XII IPS, XII IBBKurikulumKurikulum Merdeka dan Kurikulum 2013AlamatLokasiJl. Sarimanis I No. 1 Sarijadi Bandung, Bandung, Jawa Barat,  IndonesiaTel./Faks.(022...

Caroline J. Monteiro, yang akrab dikenal dengan nama Olin Monteiro, merupakan seorang aktivis perempuan dan gender, produser film dokumenter perempuan, penulis dan peneliti sejak tahun 1995. Ia salah satu pendiri Koalisi Perempuan Indonesia (1998). Ia mendirikan jaringan relawan perempuan perdamaian atau Peace Women Across the Globe atau PWAG sejak 2005, PWAG berpusat di Swiss, menominasikan 1000 perempuan perdamaian di dunia utk nobel perdamaian, kemudian khusus menjadi PWAG Indonesia. Ia ke...

 

 

SitubondoKecamatanNegara IndonesiaProvinsiJawa TimurKabupatenSitubondoPemerintahan • CamatIr. Quratul AiniLuas • Total29,32 km2 (11,32 sq mi)Populasi (2021)[1] • Total48.119 jiwa • Kepadatan1.641/km2 (4,250/sq mi)Kode pos68311 - 68318Kode Kemendagri35.12.07 Desa/kelurahan4 desa2 kelurahanSitus websitubondo.situbondokab.go.id Alun-alun kota Situbondo (tahun 1927-1929) Situbondo adalah ibu kota Kabupaten Situb...

 

 

III Distrito Electoral Local de Ciudad de México Distrito electoral localCabecera distrital AzcapotzalcoEntidad Distrito electoral local • País México • Estado Ciudad de MéxicoDiputado Nancy Marlene Núñez Reséndiz Alcaldía AzcapotzalcoEventos históricos   • Creación 1988Superficie   • Total 17.17[1]​ km²Población (2020)   • Total 258,644[1]​ hab.[editar datos en Wikidata] El III Distrito Electoral Lo...

Stephen CurryNo. 30 – Golden State WarriorsPosisiPoint guard, shooting guardLigaNBAInformasi pribadiLahir14 Maret , 1988Akron, Ohio, Amerika SerikatKebangsaanAmerika SerikatTinggi6 ft 2 in (1,88 m)Berat190 pon (86 kg)Informasi karierPerguruan tinggiDavidson (2006-2009)Draf NBA2009 / Babak: 1 / Pick: 7Dipilih oleh Golden State WarriorsKarier bermain2009–sekarangPrestasi dan pencapaian karier 4× NBA Champion (2015, 2017, 2018, 2022) 2× NBA Most Valuable Pl...

 

 

Types of essential oils For other uses, see Attar (disambiguation). This article needs additional citations for verification. Please help improve this article by adding citations to reliable sources. Unsourced material may be challenged and removed.Find sources: Attar – news · newspapers · books · scholar · JSTOR (April 2020) (Learn how and when to remove this message) Camel skin perfume bottles from Kannauj. The bottles are for aging the perfume (the ...

 

 

American politician Samuel S. YoderSergeant at Arms of the United States House of RepresentativesIn officeDecember 8, 1891 – August 7, 1893LeaderCharles Frederick CrispPreceded byAdoniram J. HolmesSucceeded byHerman W. SnowMember of the U.S. House of Representativesfrom Ohio's 4th districtIn officeMarch 4, 1887 – March 3, 1891Preceded byCharles M. AndersonSucceeded byMartin K. Gantz Personal detailsBorn(1841-08-16)August 16, 1841Berlin, OhioDiedMay 11, 1921(1...

この項目には、一部のコンピュータや閲覧ソフトで表示できない文字が含まれています(詳細)。 数字の大字(だいじ)は、漢数字の一種。通常用いる単純な字形の漢数字(小字)の代わりに同じ音の別の漢字を用いるものである。 概要 壱万円日本銀行券(「壱」が大字) 弐千円日本銀行券(「弐」が大字) 漢数字には「一」「二」「三」と続く小字と、「壱」「�...

 

 

この項目には、一部のコンピュータや閲覧ソフトで表示できない文字が含まれています(詳細)。 数字の大字(だいじ)は、漢数字の一種。通常用いる単純な字形の漢数字(小字)の代わりに同じ音の別の漢字を用いるものである。 概要 壱万円日本銀行券(「壱」が大字) 弐千円日本銀行券(「弐」が大字) 漢数字には「一」「二」「三」と続く小字と、「壱」「�...

 

 

本條目存在以下問題,請協助改善本條目或在討論頁針對議題發表看法。 此條目需要擴充。 (2013年1月1日)请協助改善这篇條目,更進一步的信息可能會在討論頁或扩充请求中找到。请在擴充條目後將此模板移除。 此條目需要补充更多来源。 (2013年1月1日)请协助補充多方面可靠来源以改善这篇条目,无法查证的内容可能會因為异议提出而被移除。致使用者:请搜索一下条目的...

Violations of the convexity assumptions of elementary economics Non-convexity (economics) is included in the JEL classification codes as JEL: C65 In economics, non-convexity refers to violations of the convexity assumptions of elementary economics. Basic economics textbooks concentrate on consumers with convex preferences (that do not prefer extremes to in-between values) and convex budget sets and on producers with convex production sets; for convex models, the predicted economic behavi...

 

 

This article needs additional citations for verification. Please help improve this article by adding citations to reliable sources. Unsourced material may be challenged and removed.Find sources: Huguenots in South Africa – news · newspapers · books · scholar · JSTOR (April 2009) (Learn how and when to remove this message) Ethnic group French South Africans Sud-africains français Franse Suid-Afrikaners Commemorating 300 years of Huguenot history in So...

 

 

This article needs additional citations for verification. Please help improve this article by adding citations to reliable sources. Unsourced material may be challenged and removed.Find sources: Louisville Metro Council – news · newspapers · books · scholar · JSTOR (January 2024) (Learn how and when to remove this message) Louisville Metro CouncilTypeTypeUnicameral of Louisville/Jefferson County Metro, KentuckyTerm limitsNoneHistoryFoundedJanuary ...

New Zealand cricket team in South Africa in 2005–06    New Zealand South AfricaDates 21 October 2005 – 7 May 2006Captains Stephen Fleming Graeme SmithTest seriesResult South Africa won the 3-match series 2–0Most runs Stephen Fleming (351) Hashim Amla (233)Most wickets James Franklin (15) Makhaya Ntini (20)Player of the series Makhaya Ntini (SA)One Day International seriesResults South Africa won the 5-match series 4–0Most runs Lou Vincent (167) Graeme Smith (161)Most w...

 

 

لويس الثاني، دوق بوربون (بالفرنسية: Louis II de Bourbon)‏    دوق بوربون فترة الحكم1356- 10 أغسطس 1410 بيير الأول جان الأول معلومات شخصية تاريخ الميلاد 4 أغسطس 1337   الوفاة 19 أغسطس 1410 (73 سنة)   مونلوسون  مواطنة فرنسا  الزوجة آن من أوفرن (19 أغسطس 1371–)  الأولاد جان الأول، دوق بو�...

 

 

Spurdog jepang Squalus japonicus Status konservasiGentingIUCN161433 TaksonomiKerajaanAnimaliaFilumChordataKelasChondrichthyesOrdoSqualiformesFamiliSqualidaeGenusSqualusSpesiesSqualus japonicus Chiyomatsu Ishikawa, 1908 DistribusiPeta sebaran spesies Spurdog jepang (Squalus japonicus) adalah sejenis ikan hiu anjing, anggota famili Squalidae. Ikan ini ditemukan di Samudra Pasifik bagian barat – Jepang tenggara dan Laut Cina Timur,[2] termasuk Republik Korea, Filipina, dan Laut Arafura...

Indian actor (born 1990) Sai Varun TejVarun in 2018BornKonidela Sai Varun Tej (1990-01-19) 19 January 1990 (age 34)[1]NationalityIndianAlma materSt. Mary's College, HyderabadOccupationActorYears active2014–presentSpouse Lavanya Tripathi ​(m. 2023)​[2][3]FatherNagendra BabuFamilySee Konidela–Allu family Konidela Sai Varun Tej (born 19 January 1990) is an Indian actor who works in Telugu films. He made his acting debut in 2...

 

 

Contea di CastigliaCastiglia Rodrigo Figli Diego ? Diego Figli Rodrigo Gonzalo Marello Diego Fernando Gutina Asura Gomez Nuño Muñoz Figli Nuño Nuñez Muniadomna Gonzalo Téllez Figli Munio Gonzales Nuño Nuñez Gonzalo Fernández Figli Fernan Gonzales Ramiro Gonzales Fernando Ansúrez Figli Ansur Nuño Fernández Figli Diego Nuñez Gutier Núñez Ferdinando Gonzales Figli Gonzalo Sancho Garcia Urraca Fronilde Nuno Muniadona Ansur Fernández Figli Fernando Teresa Oveco Munio Gutierre Gonza...