Razor into the Razor'verse
Razor into the Razor'verse
Ed Charbeneau
my name is
HELLO
Razor into the Razor'verse
Razor into the Razor'verse
• Razor (syntax)
• Razor Views
• Html Helpers
• Razor Pages
• Tag Helpers
• View Components
• Blazor
• Razor Components
Razor-verse
Terminology or technology?
??
??
??
??
??
??
ASP.NET Razor
The Razor syntax is a template markup
syntax, based on the C# programming
language
ASP.NET Razor
• Introduced July 2010 by Scott Guthrie
• Shipped January 2011 with Visual Studio
2010
• Improve the template experience
<ul>
<% foreach (p in people) { %>
<li><% p.Name %></li>
<% } %>
</ul>
WebForms
Why Razor?
<ul>
@foreach (p in people)
{
<li>@p.Name</li>
}
</ul>
Razor
<ul>
<li *ngFor="let p of person">
{{c.name}}
</li>
</ul>
Angular
Compare
<ul>
@foreach (p in people)
{
<li>@p.Name</li>
}
</ul>
Razor
@{
var greeting = "Hello";
}
<p>@greeting</p>
@{
greeting = "Howdy";
}
<p>@greeting</p>
IN
Razor Syntax: Code Blocks
<p>Hello</p>
<p>Howdy</p>
Out: HTML
<span>@( 5 + 10 + 20 )</span>
IN
Razor Syntax: Complex Expression
<span>35</span>
Out: HTML
@if (value % 2 == 0)
{
<p>The value was even.</p>
}
else if (value >= 1337)
{
<p>The value is large.</p>
}
else
{
<p>The value is odd and small.</p>
}
cshtml
Razor Syntax: @if
Razor Syntax: Control structures
Keyword
Try catch
While
For
Foreach
If
Do while
Ternary (?: operator)
Razor Syntax: Directives
@using adds C# using directive to view
@inherits view class
@inject inject service
@functions add C# code block to a view
Razor Complexities
Rendering
• Generating C# code from the template
• Compiling the C# code into an assembly
• Loading the assembly into memory
• Executing your compiled template
// Not real code
var engine = new Razor();
var result = engine.RenderTemplate(path);
Fail
Razor For Templates?
Razor Complexities
Tightly Coupled to ASP.NET
• IView
• HtmlEncoder
• TextWriter
• HttpContext
1 var engine = new RazorLightEngineBuilder()
2 .UseMemoryCachingProvider()
3 .Build();
4
5 string template = "Hello, @Model.Name. Welcome to RazorLight repository";
6 ViewModel model = new ViewModel() { Name = "John Doe" };
7
8 string result = await engine.CompileRenderAsync(“uid", template, model);
RazorLight
Razor For Templates?
• Razor (syntax)
• Razor Views
• Html Helpers
• Razor Pages
• Tag Helpers
• View Components
• Blazor
• Razor Components
Razor-verse
Terminology or technology?
??
??
??
??
??
??
Razor views (cshtml)
• Streamlined for code-focused templating
• Returned from a controller Action as a ViewResult
• Content is made of
– HTML
– HTML Helpers *typical
– Tag Helpers *new
– Razor Components *bleeding edge
<ul>
<% foreach (p in people) { %>
<li><% p.Name %></li>
<% } %>
</ul>
WebForms
ASP.NET MVC View engines
<ul>
@foreach (p in people)
{
<li>@p.Name</li>
}
</ul>
Razor
Razor Syntax: Directives
@model model type for view
@section enable views to render content to
parts of page
@addTagHelper adds a Tag Helper to scope (.NET Core)
Razor into the Razor'verse
• Razor (syntax)
• Razor Views
• Html Helpers
• Razor Pages
• Tag Helpers
• View Components
• Blazor
• Razor Components
Razor-verse
Terminology or technology?
??
??
??
??
??
??
HTML Helpers
• Invoked as methods within HTML in Razor views
• Incapsulates a block of HTML and Razor Code
• Produces an HTML string
HTML Helpers
Html.ActionLink()
Html.BeginForm()
Html.CheckBox()
Html.DropDownList()
Html.EndForm()
Html.Hidden()
Html.ListBox()
Html.Password()
Html.RadioButton()
Html.TextArea()
Html.TextBox()
@Html.ActionLink("Create New", "Create")
In
HTML Helper Usage
<a href="/Student/Create">Create New</a>
Out
Creating HTML Helpers
• Extends IHtmlHelper as an extension method
• Returns IHtmlContent
Func<IHtmlHelper, IHtmlContent>
(extension) IHtmlContent Func(this IHtmlHelper htmlHelper)
Signature
Custom HTML Helper
public static IHtmlContent BeerCity(this IHtmlHelper htmlHelper)
=> new HtmlString("<img src=/img/fulllogo.png />");
Example
Razor into the Razor'verse
• Razor (syntax)
• Razor Views
• Html Helpers
• Razor Pages
• Tag Helpers
• View Components
• Blazor
• Razor Components
Razor-verse
Terminology or technology?
??
??
??
??
??
??
Razor Pages
• Introduced in ASP.NET Core
• Page-focused approach incorporates its own
Controller/Action/Routing
• Can integrate with MVC
• Content is made of:
– HTML
– Tag Helpers *typical
– HTML Helpers *compatible
– Razor Components *bleeding edge
MVC vs. Razor Pages
@page
@model IndexModel
<h2>Separate page model</h2>
<p>
@Model.Message
</p>
Signature
Custom HTML Helper
public class IndexModel : PageModel
{
public string Message
{
get;
private set;
} = "PageModel in C#";
public void OnGet()
{
Message += $"Server time is { DateTime.Now }";
}
}
Example
Razor into the Razor'verse
• Razor (syntax)
• Razor Views
• Html Helpers
• Razor Pages
• Tag Helpers
• View Components
• Blazor
• Razor Components
Razor-verse
Terminology or technology?
??
??
??
??
??
??
Tag Helpers
• Async server-side processing via HTML elements
• Use HTML’like Tags and Attributes
• Eliminate context switching between HTML and C#
• Designed for Unit Testing
@Html.Label(“Name”, “First Name:”, new { @class = “caption” })
Signature
HTML Helpers vs. Tag Helpers
<label asp-for=“Name” class=“caption”>First Name:</label>
Example
@(Html.Kendo().Grid<Customer>().Name("grid")
.Columns(columns =>
{
columns.Bound(c => c.ContactName);
columns.Bound(c => c.ContactTitle);
columns.Bound(c => c.CompanyName);
columns.Bound(c => c.Country);
})
HTML Helpers vs. Tag Helpers
<kendo-grid name="grid" height="550">
<columns>
<column field="ContactName" title="Contact Name" />
<column field="ContactTitle" title="Contact Title" />
<column field="CompanyName" title="Company Name" />
<column field="Country" title="Country“ />
</columns>
</kendo-grid>
Tag Helper Directives
@addTagHelper Component, NameSpace Adds a Tag Helper to scope
@addTagHelper *, Kendo.Mvc Ex: 3rd party Tag Helpers
@removeTagHelper Component, Namespace Removes a Tag Helper from scope
@tagHelperPrefix th: Prefixes Tag Helpers ex: <th:myWidget>
Built-in ASP.NET Core Tag Helpers
• Anchor
• Cache
• Distributed Cache
• Environment
• Form
• Form Action
• Image
• Input
• Label
• Partial
• Select
• Textarea
• Validation Message
• Validation Summary
Tag Helpers: Example
<kendo-datepicker name="startDate"
start="CalendarView.Year"
depth="CalendarView.Year"
format="MMMM yyyy"
value='DateTime.Parse("May 2019")' />
Razor into the Razor'verse
• Razor (syntax)
• Razor Views
• Html Helpers
• Razor Pages
• Tag Helpers
• View Components
• Blazor
• Razor Components
Razor-verse
Terminology or technology?
??
??
??
??
??
??
View Components
• Renders a chunk rather than a whole response
• Similarities with controller and view
• Can have parameters and business logic
• Is typically invoked from a layout page
• Deprecated by Razor Components??
List Items From Database
<vc:priority-list max-priority="2"
is-done="false">
</vc:priority-list>
• Razor (syntax)
• Razor Views
• Html Helpers
• Razor Pages
• Tag Helpers
• View Components
• Blazor
• Razor Components
Razor-verse
Terminology or technology?
??
??
??
??
??
??
Razor Component (Blazor Framework)
• Razor Syntax
• Component Architecture vs. HTML generator
• Creates a RenderTree (DOM Abstraction)
• Similar to JSX for React
• Uses .razor file extension
• .razor files are used for code generation of .NET
classes
– These classes implement a RenderTree
Razor into the Razor'verse
Browser
JavaScript (.js)
Parser
Compiler
JIT Interpreter
Native Web APIs
(DOM, file storage, etc)
HTML (.html)
Inline JS
JavaScriptRuntime
AST
Byte code
WebAssembly (.wasm)
Compiler
PUBLISHING
COMPONENT MODEL FORMS & VALIDATION
DEPENDENCY INJECTION
AUTO REBUILDUNIT TESTING
JAVASCRIPT INTEROP
SERVER-SIDE RENDERING
DEBUGGING
INTELLISENSE & TOOLING
LAYOUTS
ASSEMBLY TRIMMING
COMPONENT PACKAGES
ROUTING
Blazor
• What it is
• Client Side C#
• Web Standard Technologies
• Mono Runtime for
WebAssembly
• .NET Standard
• What it’s NOT
• A Plugin
• ASP.NET WebForms
• Silverlight
• Trans-piled JavaScript
Browser
Parser
Compiler
JIT Interpreter
Native Web APIs
(DOM, file storage, etc)
JavaScriptRuntime
AST
Byte code
blazor.js
mono.wasm
Bootstrapping HTML
mono.js
netstandard.dll app.dll
Interop layer
Blazor Components (.razor)
Razor into the Razor'verse
Schedule
Razor into the Razor'verse
• demos.telerik.com/blazor
• Blazor.net
• EdCharbeneau.com
• BlazorPro.com
Resources

More Related Content

PPTX
Goodbye JavaScript Hello Blazor
PPTX
PPTX
Blazor Full-Stack
PPTX
PPTX
Blazor - An Introduction
PPTX
PDF
Blazor web apps
PPTX
Web Components
Goodbye JavaScript Hello Blazor
Blazor Full-Stack
Blazor - An Introduction
Blazor web apps
Web Components

What's hot (20)

PPTX
Polymer and web component
PDF
Custom Elements with Polymer Web Components #econfpsu16
PDF
BP101: A Modernized Workflow w/ Domino/XPages
PPTX
How to build a web application with Polymer
PDF
Stencil the time for vanilla web components has arrived
PDF
Polymer - Welcome to the Future @ PyGrunn 08/07/2014
PPTX
Polymer / WebComponents
PDF
Web components the future is here
PDF
Booting up with polymer
PDF
Introduction to Web Components
PDF
Blazor introduction
PDF
Introduction to Web Components
PDF
Polymer
PPTX
The rise of Polymer and Web Components (Kostas Karolemeas) - GreeceJS #17
PDF
Building a Secure App with Google Polymer and Java / Spring
PPTX
PDF
Web Components
PDF
HTML5와 오픈소스 기반의 Web Components 기술
PDF
Александр Кашеверов - Polymer
PDF
NextJS, A JavaScript Framework for building next generation SPA
Polymer and web component
Custom Elements with Polymer Web Components #econfpsu16
BP101: A Modernized Workflow w/ Domino/XPages
How to build a web application with Polymer
Stencil the time for vanilla web components has arrived
Polymer - Welcome to the Future @ PyGrunn 08/07/2014
Polymer / WebComponents
Web components the future is here
Booting up with polymer
Introduction to Web Components
Blazor introduction
Introduction to Web Components
Polymer
The rise of Polymer and Web Components (Kostas Karolemeas) - GreeceJS #17
Building a Secure App with Google Polymer and Java / Spring
Web Components
HTML5와 오픈소스 기반의 Web Components 기술
Александр Кашеверов - Polymer
NextJS, A JavaScript Framework for building next generation SPA
Ad

Similar to Razor into the Razor'verse (20)

PPTX
The Django Web Application Framework 2
PPTX
The Django Web Application Framework 2
PPTX
The Django Web Application Framework 2
PPTX
The Django Web Application Framework 2
PPSX
DIWE - Coding HTML for Basic Web Designing
PDF
Familiar HTML5 - 事例とサンプルコードから学ぶ 身近で普通に使わているHTML5
PDF
PDF
Introduccion a HTML5
PPTX
Web Development Course - HTML5 & CSS3 by RSOLUTIONS
PPTX
HTML - hypertext markup language
PPTX
HTML CSS and Web Development
PPTX
MVC & SQL_In_1_Hour
ODP
Introduction of Html/css/js
PPT
A quick guide to Css and java script
PDF
HTML5 Refresher
PDF
C# Advanced L09-HTML5+ASP
PPT
Html5 css3
PPTX
Html5 ppt
KEY
Html5, a gentle introduction
PPT
Web development basics (Part-1)
The Django Web Application Framework 2
The Django Web Application Framework 2
The Django Web Application Framework 2
The Django Web Application Framework 2
DIWE - Coding HTML for Basic Web Designing
Familiar HTML5 - 事例とサンプルコードから学ぶ 身近で普通に使わているHTML5
Introduccion a HTML5
Web Development Course - HTML5 & CSS3 by RSOLUTIONS
HTML - hypertext markup language
HTML CSS and Web Development
MVC & SQL_In_1_Hour
Introduction of Html/css/js
A quick guide to Css and java script
HTML5 Refresher
C# Advanced L09-HTML5+ASP
Html5 css3
Html5 ppt
Html5, a gentle introduction
Web development basics (Part-1)
Ad

More from Ed Charbeneau (17)

PPTX
Writing JavaScript for C# Blazor.pptx
PPTX
Blazor Stability Testing Tools for Bullet Proof Applications
PPTX
Secrets of a Blazor Component Artisan (v2)
PPTX
Modernizing Web Apps with .NET 6.pptx
PPTX
Modernizing Web Apps with .NET 6.pptx
PPTX
Secrets of a Blazor Component Artisan
PPTX
Writing java script for Csharp's Blazor
PPTX
Giving Clarity to LINQ Queries by Extending Expressions R2
PPTX
The future of .NET lightning talk
PPTX
Into the next dimension
PPTX
Giving Clarity to LINQ Queries by Extending Expressions
PPTX
What is new in Q2 2015
PPTX
TelerikNEXT What's new in UI for ASP.NET AJAX
PPTX
Journey to JavaScript (from C#)
PPTX
Refactoring css
PPTX
Don't be a stereotype: Rapid Prototype
PPTX
A crash course in responsive design
Writing JavaScript for C# Blazor.pptx
Blazor Stability Testing Tools for Bullet Proof Applications
Secrets of a Blazor Component Artisan (v2)
Modernizing Web Apps with .NET 6.pptx
Modernizing Web Apps with .NET 6.pptx
Secrets of a Blazor Component Artisan
Writing java script for Csharp's Blazor
Giving Clarity to LINQ Queries by Extending Expressions R2
The future of .NET lightning talk
Into the next dimension
Giving Clarity to LINQ Queries by Extending Expressions
What is new in Q2 2015
TelerikNEXT What's new in UI for ASP.NET AJAX
Journey to JavaScript (from C#)
Refactoring css
Don't be a stereotype: Rapid Prototype
A crash course in responsive design

Recently uploaded (20)

PPTX
GSA Content Generator Crack (2025 Latest)
PPTX
Full-Stack Developer Courses That Actually Land You Jobs
PDF
Topaz Photo AI Crack New Download (Latest 2025)
PDF
How Tridens DevSecOps Ensures Compliance, Security, and Agility
PPTX
WiFi Honeypot Detecscfddssdffsedfseztor.pptx
PDF
E-Commerce Website Development Companyin india
PDF
Introduction to Ragic - #1 No Code Tool For Digitalizing Your Business Proces...
PPTX
CNN LeNet5 Architecture: Neural Networks
PDF
Microsoft Office 365 Crack Download Free
PDF
AI Guide for Business Growth - Arna Softech
PPTX
Download Adobe Photoshop Crack 2025 Free
PDF
EaseUS PDF Editor Pro 6.2.0.2 Crack with License Key 2025
PDF
Guide to Food Delivery App Development.pdf
DOCX
Modern SharePoint Intranet Templates That Boost Employee Engagement in 2025.docx
DOCX
How to Use SharePoint as an ISO-Compliant Document Management System
PPTX
Introduction to Windows Operating System
PDF
AI-Powered Threat Modeling: The Future of Cybersecurity by Arun Kumar Elengov...
PPTX
Cybersecurity-and-Fraud-Protecting-Your-Digital-Life.pptx
PDF
Top 10 Software Development Trends to Watch in 2025 🚀.pdf
PDF
Salesforce Agentforce AI Implementation.pdf
GSA Content Generator Crack (2025 Latest)
Full-Stack Developer Courses That Actually Land You Jobs
Topaz Photo AI Crack New Download (Latest 2025)
How Tridens DevSecOps Ensures Compliance, Security, and Agility
WiFi Honeypot Detecscfddssdffsedfseztor.pptx
E-Commerce Website Development Companyin india
Introduction to Ragic - #1 No Code Tool For Digitalizing Your Business Proces...
CNN LeNet5 Architecture: Neural Networks
Microsoft Office 365 Crack Download Free
AI Guide for Business Growth - Arna Softech
Download Adobe Photoshop Crack 2025 Free
EaseUS PDF Editor Pro 6.2.0.2 Crack with License Key 2025
Guide to Food Delivery App Development.pdf
Modern SharePoint Intranet Templates That Boost Employee Engagement in 2025.docx
How to Use SharePoint as an ISO-Compliant Document Management System
Introduction to Windows Operating System
AI-Powered Threat Modeling: The Future of Cybersecurity by Arun Kumar Elengov...
Cybersecurity-and-Fraud-Protecting-Your-Digital-Life.pptx
Top 10 Software Development Trends to Watch in 2025 🚀.pdf
Salesforce Agentforce AI Implementation.pdf

Razor into the Razor'verse

  • 6. • Razor (syntax) • Razor Views • Html Helpers • Razor Pages • Tag Helpers • View Components • Blazor • Razor Components Razor-verse Terminology or technology? ?? ?? ?? ?? ?? ??
  • 7. ASP.NET Razor The Razor syntax is a template markup syntax, based on the C# programming language
  • 8. ASP.NET Razor • Introduced July 2010 by Scott Guthrie • Shipped January 2011 with Visual Studio 2010 • Improve the template experience
  • 9. <ul> <% foreach (p in people) { %> <li><% p.Name %></li> <% } %> </ul> WebForms Why Razor? <ul> @foreach (p in people) { <li>@p.Name</li> } </ul> Razor
  • 10. <ul> <li *ngFor="let p of person"> {{c.name}} </li> </ul> Angular Compare <ul> @foreach (p in people) { <li>@p.Name</li> } </ul> Razor
  • 11. @{ var greeting = "Hello"; } <p>@greeting</p> @{ greeting = "Howdy"; } <p>@greeting</p> IN Razor Syntax: Code Blocks <p>Hello</p> <p>Howdy</p> Out: HTML
  • 12. <span>@( 5 + 10 + 20 )</span> IN Razor Syntax: Complex Expression <span>35</span> Out: HTML
  • 13. @if (value % 2 == 0) { <p>The value was even.</p> } else if (value >= 1337) { <p>The value is large.</p> } else { <p>The value is odd and small.</p> } cshtml Razor Syntax: @if
  • 14. Razor Syntax: Control structures Keyword Try catch While For Foreach If Do while Ternary (?: operator)
  • 15. Razor Syntax: Directives @using adds C# using directive to view @inherits view class @inject inject service @functions add C# code block to a view
  • 16. Razor Complexities Rendering • Generating C# code from the template • Compiling the C# code into an assembly • Loading the assembly into memory • Executing your compiled template
  • 17. // Not real code var engine = new Razor(); var result = engine.RenderTemplate(path); Fail Razor For Templates?
  • 18. Razor Complexities Tightly Coupled to ASP.NET • IView • HtmlEncoder • TextWriter • HttpContext
  • 19. 1 var engine = new RazorLightEngineBuilder() 2 .UseMemoryCachingProvider() 3 .Build(); 4 5 string template = "Hello, @Model.Name. Welcome to RazorLight repository"; 6 ViewModel model = new ViewModel() { Name = "John Doe" }; 7 8 string result = await engine.CompileRenderAsync(“uid", template, model); RazorLight Razor For Templates?
  • 20. • Razor (syntax) • Razor Views • Html Helpers • Razor Pages • Tag Helpers • View Components • Blazor • Razor Components Razor-verse Terminology or technology? ?? ?? ?? ?? ?? ??
  • 21. Razor views (cshtml) • Streamlined for code-focused templating • Returned from a controller Action as a ViewResult • Content is made of – HTML – HTML Helpers *typical – Tag Helpers *new – Razor Components *bleeding edge
  • 22. <ul> <% foreach (p in people) { %> <li><% p.Name %></li> <% } %> </ul> WebForms ASP.NET MVC View engines <ul> @foreach (p in people) { <li>@p.Name</li> } </ul> Razor
  • 23. Razor Syntax: Directives @model model type for view @section enable views to render content to parts of page @addTagHelper adds a Tag Helper to scope (.NET Core)
  • 25. • Razor (syntax) • Razor Views • Html Helpers • Razor Pages • Tag Helpers • View Components • Blazor • Razor Components Razor-verse Terminology or technology? ?? ?? ?? ?? ?? ??
  • 26. HTML Helpers • Invoked as methods within HTML in Razor views • Incapsulates a block of HTML and Razor Code • Produces an HTML string
  • 28. @Html.ActionLink("Create New", "Create") In HTML Helper Usage <a href="/Student/Create">Create New</a> Out
  • 29. Creating HTML Helpers • Extends IHtmlHelper as an extension method • Returns IHtmlContent
  • 30. Func<IHtmlHelper, IHtmlContent> (extension) IHtmlContent Func(this IHtmlHelper htmlHelper) Signature Custom HTML Helper public static IHtmlContent BeerCity(this IHtmlHelper htmlHelper) => new HtmlString("<img src=/img/fulllogo.png />"); Example
  • 32. • Razor (syntax) • Razor Views • Html Helpers • Razor Pages • Tag Helpers • View Components • Blazor • Razor Components Razor-verse Terminology or technology? ?? ?? ?? ?? ?? ??
  • 33. Razor Pages • Introduced in ASP.NET Core • Page-focused approach incorporates its own Controller/Action/Routing • Can integrate with MVC • Content is made of: – HTML – Tag Helpers *typical – HTML Helpers *compatible – Razor Components *bleeding edge
  • 34. MVC vs. Razor Pages
  • 35. @page @model IndexModel <h2>Separate page model</h2> <p> @Model.Message </p> Signature Custom HTML Helper public class IndexModel : PageModel { public string Message { get; private set; } = "PageModel in C#"; public void OnGet() { Message += $"Server time is { DateTime.Now }"; } } Example
  • 37. • Razor (syntax) • Razor Views • Html Helpers • Razor Pages • Tag Helpers • View Components • Blazor • Razor Components Razor-verse Terminology or technology? ?? ?? ?? ?? ?? ??
  • 38. Tag Helpers • Async server-side processing via HTML elements • Use HTML’like Tags and Attributes • Eliminate context switching between HTML and C# • Designed for Unit Testing
  • 39. @Html.Label(“Name”, “First Name:”, new { @class = “caption” }) Signature HTML Helpers vs. Tag Helpers <label asp-for=“Name” class=“caption”>First Name:</label> Example
  • 40. @(Html.Kendo().Grid<Customer>().Name("grid") .Columns(columns => { columns.Bound(c => c.ContactName); columns.Bound(c => c.ContactTitle); columns.Bound(c => c.CompanyName); columns.Bound(c => c.Country); }) HTML Helpers vs. Tag Helpers <kendo-grid name="grid" height="550"> <columns> <column field="ContactName" title="Contact Name" /> <column field="ContactTitle" title="Contact Title" /> <column field="CompanyName" title="Company Name" /> <column field="Country" title="Country“ /> </columns> </kendo-grid>
  • 41. Tag Helper Directives @addTagHelper Component, NameSpace Adds a Tag Helper to scope @addTagHelper *, Kendo.Mvc Ex: 3rd party Tag Helpers @removeTagHelper Component, Namespace Removes a Tag Helper from scope @tagHelperPrefix th: Prefixes Tag Helpers ex: <th:myWidget>
  • 42. Built-in ASP.NET Core Tag Helpers • Anchor • Cache • Distributed Cache • Environment • Form • Form Action • Image • Input • Label • Partial • Select • Textarea • Validation Message • Validation Summary
  • 43. Tag Helpers: Example <kendo-datepicker name="startDate" start="CalendarView.Year" depth="CalendarView.Year" format="MMMM yyyy" value='DateTime.Parse("May 2019")' />
  • 45. • Razor (syntax) • Razor Views • Html Helpers • Razor Pages • Tag Helpers • View Components • Blazor • Razor Components Razor-verse Terminology or technology? ?? ?? ?? ?? ?? ??
  • 46. View Components • Renders a chunk rather than a whole response • Similarities with controller and view • Can have parameters and business logic • Is typically invoked from a layout page • Deprecated by Razor Components??
  • 47. List Items From Database <vc:priority-list max-priority="2" is-done="false"> </vc:priority-list>
  • 48. • Razor (syntax) • Razor Views • Html Helpers • Razor Pages • Tag Helpers • View Components • Blazor • Razor Components Razor-verse Terminology or technology? ?? ?? ?? ?? ?? ??
  • 49. Razor Component (Blazor Framework) • Razor Syntax • Component Architecture vs. HTML generator • Creates a RenderTree (DOM Abstraction) • Similar to JSX for React • Uses .razor file extension • .razor files are used for code generation of .NET classes – These classes implement a RenderTree
  • 51. Browser JavaScript (.js) Parser Compiler JIT Interpreter Native Web APIs (DOM, file storage, etc) HTML (.html) Inline JS JavaScriptRuntime AST Byte code WebAssembly (.wasm) Compiler
  • 52. PUBLISHING COMPONENT MODEL FORMS & VALIDATION DEPENDENCY INJECTION AUTO REBUILDUNIT TESTING JAVASCRIPT INTEROP SERVER-SIDE RENDERING DEBUGGING INTELLISENSE & TOOLING LAYOUTS ASSEMBLY TRIMMING COMPONENT PACKAGES ROUTING Blazor
  • 53. • What it is • Client Side C# • Web Standard Technologies • Mono Runtime for WebAssembly • .NET Standard • What it’s NOT • A Plugin • ASP.NET WebForms • Silverlight • Trans-piled JavaScript
  • 54. Browser Parser Compiler JIT Interpreter Native Web APIs (DOM, file storage, etc) JavaScriptRuntime AST Byte code blazor.js mono.wasm Bootstrapping HTML mono.js netstandard.dll app.dll Interop layer Blazor Components (.razor)
  • 58. • demos.telerik.com/blazor • Blazor.net • EdCharbeneau.com • BlazorPro.com Resources

Editor's Notes

  • #3: Ok, let’s do this
  • #4: My name is ed charbeneau
  • #5: I’m a developer advocate for Progress We make UI components for everything
  • #10: The default Razor language is HTML. Rendering HTML from Razor markup is no different than rendering HTML from an HTML file. HTML markup in .cshtml Razor files is rendered by the server unchanged. Razor supports C# and uses the @ symbol to transition from HTML to C#. Razor evaluates C# expressions and renders them in the HTML output. When an @ symbol is followed by a Razor reserved keyword, it transitions into Razor-specific markup. Otherwise, it transitions into plain C#. Razor code blocks start with @ and are enclosed by {}. Unlike expressions, C# code inside code blocks isn't rendered. Code blocks and expressions in a view share the same scope and are defined in order.
  • #17: https://daveaglick.com/posts/the-bleeding-edge-of-razor
  • #19: https://daveaglick.com/posts/the-bleeding-edge-of-razor
  • #44: Another example from Telerik UI for ASP.NET Core. This is the Tag Helper for the Date Picker. The Tag Helper is using attribute values that are strong-typed.
  • #50: Build rich, interactive client UI without writing JavaScript Create reusable UI components with C# and Razor Integrates with your existing ASP.NET Core applications Blazor apps are based on components. A component in Blazor is an element of UI, such as a page, dialog, or data entry form. Components handle user events and define flexible UI rendering logic. Components can be nested and reused. Components are .NET classes built into .NET assemblies that can be shared and distributed as NuGet packages. The component class is usually written in the form of a Razor markup page with a .razor file extension. Components in Blazor are sometimes referred to as Razor components. Razor is a syntax for combining HTML markup with C# code designed for developer productivity. Razor allows you to switch between HTML markup and C# in the same file with IntelliSense support. Razor Pages and MVC also use Razor. Unlike Razor Pages and MVC, which are built around a request/response model, components are used specifically for client-side UI logic and composition.
  • #52: Opens a gateway to the language multiverse
  • #53: Finally let’s talk Blazor A different approach Blazor is a fully featured single page application framework by Microsoft It has a huge ecosystem of .NET packages on NuGet because it’s compatible with .NET standard Even Telerik has a UI components
  • #55: Mono Runtime for web assembly
  • #57: .NET Core 3 will ship in September .NET Core 3.1 will have long-term support .NET 5 release in November 2020 Major releases every year, long-term support for even-numbered releases Predictable schedule, minor releases if needed
  • #59: https://en.wikipedia.org/wiki/WebAssembly