You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ASP.NET Core MVC applications follow a request response model, where user requests are handled by controllers and rendered using views. UI updates often require full page reloads or additional techniques such as partial views or AJAX, which can increase complexity as applications become more interactive.
16
+
[ASP.NET Core MVC](https://learn.microsoft.com/en-us/aspnet/core/mvc/overview) applications follow a request response model, where user requests are handled by controllers and rendered using views. UI updates often require full page reloads or additional techniques such as partial views or AJAX, which can increase complexity as applications become more interactive.
17
17
18
-
Blazor introduces a component based, event driven UI model, where user interactions trigger updates directly within components rather than full page reloads. It enables reusable UI components and aligns closely with modern .NET development practices.
18
+
[Blazor](https://learn.microsoft.com/en-us/aspnet/core/blazor/) introduces a component based, event driven UI model, where user interactions trigger updates directly within components rather than full page reloads. It enables reusable UI components and aligns closely with modern .NET development practices.
19
19
20
20
| Aspect | ASP.NET Core MVC | Blazor |
21
21
| --- | --- | --- |
@@ -36,9 +36,9 @@ Blazor introduces a component based, event driven UI model, where user interacti
36
36
*[.NET 8 SDK or later](https://dotnet.microsoft.com/en-us/download/dotnet)
37
37
*[Visual Studio](https://visualstudio.microsoft.com/downloads/) 2022 or later, or [Visual Studio Code](https://code.visualstudio.com/) with [C# Dev Kit](https://marketplace.visualstudio.com/items?itemName=ms-dotnettools.csdevkit) extension
38
38
39
-
###Project structure comparison
39
+
## Project structure comparison
40
40
41
-
The following table maps common ASP.NET Core MVC application artifacts to their Blazor equivalents, highlighting how application structure transitions from a request driven model to a component based architecture.
41
+
The following table maps common [ASP.NET Core MVC](https://learn.microsoft.com/en-us/aspnet/core/mvc/overview) application artifacts to their [Blazor](https://learn.microsoft.com/en-us/aspnet/core/blazor/) equivalents, highlighting how application structure transitions from a request driven model to a component based architecture.
@@ -54,7 +54,7 @@ The following table maps common ASP.NET Core MVC application artifacts to their
54
54
55
55
## Migrating Components from ASP.NET Core MVC to Blazor
56
56
57
-
Create a Blazor project using one of the following getting started guides.
57
+
Create a [Blazor](https://learn.microsoft.com/en-us/aspnet/core/blazor/) project using one of the following getting started guides.
58
58
59
59
*[Getting Started with Blazor Web App](https://blazor.syncfusion.com/documentation/getting-started/blazor-web-app)
60
60
*[Getting Started with Blazor Server App](https://blazor.syncfusion.com/documentation/getting-started/blazor-server-side-visual-studio)
@@ -64,17 +64,17 @@ The following shared setup applies to all components and covers the common confi
64
64
65
65
### Package installation
66
66
67
-
In ASP.NET Core MVC, controls are typically installed using a single combined package, such as [Syncfusion.EJ2.AspNet.Core](https://www.nuget.org/packages/Syncfusion.EJ2.AspNet.Core).
67
+
In [ASP.NET Core MVC](https://learn.microsoft.com/en-us/aspnet/core/mvc/overview), controls are typically installed using a single combined package, such as [Syncfusion.EJ2.AspNet.Core](https://www.nuget.org/packages/Syncfusion.EJ2.AspNet.Core).
68
68
69
-
In Blazor applications, using individual component packages improves performance and reduces application size. For the complete list of available packages, refer to the [Blazor NuGet packages](https://blazor.syncfusion.com/documentation/nuget-packages).
69
+
In [Blazor](https://learn.microsoft.com/en-us/aspnet/core/blazor/) applications, using individual component packages improves performance and reduces application size. For the complete list of available packages, refer to the [Blazor NuGet packages](https://blazor.syncfusion.com/documentation/nuget-packages).
70
70
71
71
Additionally, install the [Syncfusion.Blazor.Themes](https://www.nuget.org/packages/Syncfusion.Blazor.Themes) NuGet package for styling support.
72
72
73
73
### Service registration
74
74
75
-
In ASP.NET Core MVC, UI components are rendered as part of the view, and additional scripts and styles are included manually. There is no dependency injection (DI) based registration model specifically for UI components.
75
+
In [ASP.NET Core MVC](https://learn.microsoft.com/en-us/aspnet/core/mvc/overview), UI components are rendered as part of the view, and additional scripts and styles are included manually. There is no dependency injection (DI) based registration model specifically for UI components.
76
76
77
-
In Blazor, components rely on the built-in dependency injection (DI) system. UI libraries like Syncfusion must be registered in the service container so that required services (such as rendering, localization, and JavaScript interop) are available to components.
77
+
In [Blazor](https://learn.microsoft.com/en-us/aspnet/core/blazor/), components rely on the built-in dependency injection (DI) system. UI libraries like Syncfusion must be registered in the service container so that required services (such as rendering, localization, and [JavaScript interop](https://learn.microsoft.com/en-us/aspnet/core/blazor/javascript-interoperability/?view=aspnetcore-10.0)) are available to components.
78
78
79
79
In the `Program.cs` file, add the Blazor namespace and register services.
80
80
@@ -97,8 +97,6 @@ var app = builder.Build();
97
97
98
98
Namespaces are imported into Razor views using `~/_ViewImports.cshtml`, primarily to enable Tag Helpers and HTML helper extensions.
99
99
100
-
Add the required namespace in `~/_ViewImports.cshtml`.
@@ -112,7 +110,7 @@ Add the required namespace in `~/_ViewImports.cshtml`.
112
110
113
111
**Blazor equivalent**
114
112
115
-
In Blazor, `~/_Imports.razor` serves a similar purpose but applies to Razor components. It allows components to access namespaces globally without requiring repeated `@using` statements in each `.razor` file.
113
+
In [Blazor](https://learn.microsoft.com/en-us/aspnet/core/blazor/), `~/_Imports.razor` serves a similar purpose but applies to Razor components. It allows components to access namespaces globally without requiring repeated `@using` statements in each `.razor` file.
116
114
117
115
Import the required namespaces in the `~/_Imports.razor` file.
118
116
@@ -217,7 +215,7 @@ For additional details, refer to the [Blazor DataGrid getting started guide](htt
217
215
The [ASP.NET Core MVC DataGrid](https://www.syncfusion.com/aspnet-mvc-ui-controls/grid) is defined using HTML Helper APIs, where [Columns](https://help.syncfusion.com/cr/aspnetmvc-js2/Syncfusion.EJ2.Grids.Grid.html#Syncfusion_EJ2_Grids_Grid_Columns) are configured through properties during component initialization.
@@ -505,7 +501,7 @@ For detailed explanation, refer to the [Blazor Rich Text Editor getting started
505
501
The [ASP.NET Core MVC Rich Text Editor](https://www.syncfusion.com/aspnet-mvc-ui-controls/wysiwyg-rich-text-editor) is initialized with configurable [ToolbarSettings](https://help.syncfusion.com/cr/aspnetmvc-js2/Syncfusion.EJ2.RichTextEditor.RichTextEditor.html#Syncfusion_EJ2_RichTextEditor_RichTextEditor_ToolbarSettings) and supports content formatting through predefined tools and customization options.
506
502
507
503
{% tabs %}
508
-
{% highlight cshtml %}
504
+
{% highlight cshtml tabtitle="Index.cshtml" %}
509
505
510
506
@using Syncfusion.EJ2
511
507
@@ -538,7 +534,6 @@ The [Blazor Rich Text Editor](https://www.syncfusion.com/blazor-components/blazo
## Why migrate from ASP.NET Core Razor Pages to Blazor?
15
15
16
-
ASP.NET Core Razor Pages simplify the MVC pattern by combining UI and logic at the page level. However, for highly interactive applications, developers often rely on JavaScript, partial rendering, and additional client-side logic to manage dynamic UI behavior.
16
+
[ASP.NET Core Razor Pages](https://learn.microsoft.com/en-us/aspnet/core/razor-pages/) simplify the MVC pattern by combining UI and logic at the page level. However, for highly interactive applications, developers often rely on JavaScript, partial rendering, and additional client-side logic to manage dynamic UI behavior.
17
17
18
-
Blazor provides a modern approach by enabling component based UI development in C#, along with built-in state management and event driven updates. This reduces dependency on external JavaScript frameworks and improves maintainability, scalability, and developer productivity.
18
+
[Blazor](https://learn.microsoft.com/en-us/aspnet/core/blazor/) provides a modern approach by enabling component based UI development in C#, along with built-in state management and event driven updates. This reduces dependency on external JavaScript frameworks and improves maintainability, scalability, and developer productivity.
19
19
20
20
| Aspect | Razor Pages | Blazor |
21
21
| --- | ---| --- |
@@ -30,8 +30,7 @@ Blazor provides a modern approach by enabling component based UI development in
30
30
| Navigation model | File based routing (`Pages/*.cshtml`) | SPA style routing using `@page`|
31
31
| Rendering model | Server rendered HTML with optional JS | Interactive rendering using server or client execution |
| JavaScript dependency | Often required for interactivity | Minimal (optional via JS interop) |
34
-
| Testing & maintainability | Moderate | Improved due to component isolation |
33
+
| JavaScript dependency | Often required for interactivity | Minimal (optional via [JS interop](https://learn.microsoft.com/en-us/aspnet/core/blazor/javascript-interoperability/?view=aspnetcore-10.0)) |
35
34
| Scalability | Depends on server rendering | Depends on hosting model |
36
35
37
36
## Prerequisites for Blazor
@@ -41,7 +40,7 @@ Blazor provides a modern approach by enabling component based UI development in
41
40
42
41
## Project structure comparison
43
42
44
-
ASP.NET Core Razor Pages and Blazor Web Apps follow different architectural patterns. The following table shows the functional equivalents between Razor Pages artifacts and Blazor, along with their roles in a Blazor Web App.
43
+
[ASP.NET Core Razor Pages](https://learn.microsoft.com/en-us/aspnet/core/razor-pages/) and [Blazor](https://learn.microsoft.com/en-us/aspnet/core/blazor/) Web Apps follow different architectural patterns. The following table shows the functional equivalents between Razor Pages artifacts and Blazor, along with their roles in a Blazor Web App.
@@ -60,7 +59,7 @@ N> Business logic, POCO models, and stateless services from Razor Pages can typi
60
59
61
60
## Migrating components from ASP.NET Core Razor Pages to Blazor
62
61
63
-
Create a Blazor project using one of the following getting started guides.
62
+
Create a [Blazor](https://learn.microsoft.com/en-us/aspnet/core/blazor/) project using one of the following getting started guides.
64
63
65
64
*[Getting Started with Blazor Web App](https://blazor.syncfusion.com/documentation/getting-started/blazor-web-app)
66
65
*[Getting Started with Blazor Server App](https://blazor.syncfusion.com/documentation/getting-started/blazor-server-side-visual-studio)
@@ -70,17 +69,17 @@ The following shared setup applies to all components and covers the common confi
70
69
71
70
### Package installation
72
71
73
-
In ASP.NET Core Razor Pages, controls are typically installed using a single combined package, such as [Syncfusion.EJ2.AspNet.Core](https://www.nuget.org/packages/Syncfusion.EJ2.AspNet.Core).
72
+
In [ASP.NET Core Razor Pages](https://learn.microsoft.com/en-us/aspnet/core/razor-pages/), controls are typically installed using a single combined package, such as [Syncfusion.EJ2.AspNet.Core](https://www.nuget.org/packages/Syncfusion.EJ2.AspNet.Core).
74
73
75
-
In Blazor applications, using individual component packages improves performance and reduces application size. For the complete list of available packages, refer to the [Blazor NuGet packages](https://blazor.syncfusion.com/documentation/nuget-packages).
74
+
In [Blazor](https://learn.microsoft.com/en-us/aspnet/core/blazor/) applications, using individual component packages improves performance and reduces application size. For the complete list of available packages, refer to the [Blazor NuGet packages](https://blazor.syncfusion.com/documentation/nuget-packages).
76
75
77
76
Additionally, install the [Syncfusion.Blazor.Themes](https://www.nuget.org/packages/Syncfusion.Blazor.Themes) NuGet package for styling support.
78
77
79
78
### Service registration
80
79
81
-
In ASP.NET Core Razor Pages, controls are configured through script and stylesheet references in the layout, rather than through DI service registration.
80
+
In [ASP.NET Core Razor Pages](https://learn.microsoft.com/en-us/aspnet/core/razor-pages/), controls are configured through script and stylesheet references in the layout, rather than through DI service registration.
82
81
83
-
Blazor, on the other hand, uses dependency injection by default. Components must be registered in the service container so the framework can provide the required functionality, such as rendering and JavaScript interaction.
82
+
[Blazor](https://learn.microsoft.com/en-us/aspnet/core/blazor/), on the other hand, uses dependency injection by default. Components must be registered in the service container so the framework can provide the required functionality, such as rendering and JavaScript interaction.
84
83
85
84
In the `Program.cs` file, add the Blazor namespace and register the required services.
86
85
@@ -136,7 +135,7 @@ The above lists the namespaces for all components covered in this guide. Import
136
135
137
136
**ASP.NET Core Razor Pages approach**
138
137
139
-
Scripts and styles are manually referenced in the shared layout (`_Layout.cshtml`). In addition controls require the `<ejs-scripts>` helper, which initializes the required JavaScript components at runtime.
138
+
Scripts and styles are manually referenced in the shared layout (`_Layout.cshtml`). In addition controls require the `<ejs-scripts>` helper, which initializes the required JavaScript controls at runtime.
0 commit comments