Development comparison
Handling GET actions
The most straightforward approach for developing MVC widgets is by using MVC controllers. They may typically have a single Index
method that handles the generic execution. Based on routing logic, they can handle various other actions.
This is convenient, but when several controllers on the page have multiple actions, you need to invest additional work to make them work together. You do this by implementing the HandleUnkownAction
method.
For more information, see Best practices for implementing custom widgets » HandleUnknownAction.
In comparison, .NET Core uses ViewComponents
that have a single method – Invoke
or InvokeAsync
, which is executed only on GET
requests.
Because there is only a single method, there are no clashes between logics of individual ViewComponents
. Each widget can respond to query string parameters separately. In addition, widgets can respond to URL segments, using a centralized logic for resolving segments, otherwise not resolved by Sitefinity CMS.
For more information, see Shared data between widgets sample project » IRequestPreparation interface on Sitefinity GitHub repository.
Handling POST actions
The MVC frontend is built to handle POST
actions, and this enables each controller to handle POST
requests, for example form posts from the frontend of the application. The drawback to this is that when you have multiple widget controllers on the same page, there is no way to determine which one should handle the POST
request.
On the other hand, .NET Core does not handle POST
actions, it only handles the GET
requests for the page. Alternatives to handling post actions are:
- Implementing a custom controller to submit data to.
- Posting form data directly to Sitefinity CMS.
For more information, see Create forms.
- Posting data by directly creating Sitefinity content, using the content modules.
Designer development
Developing designers with MVC is achieved by using AngularJS-based designers.
For more information, see Widget designers (MVC). The properties that are defined in the Controller
or Model
classes are then populated with those values.
In Sitefinity .NET Core Renderer, widget designers we use automatically generated.
For more information, see Widget designers (.NET Core).
Their benefit is that you do not need to consider the client frameworks, such as AngularJS. The properties of the widgets are placed in an Entity
class, and they are decorated with meta-attributes. The meta-attributes control the visual representation of the designers.
API
Querying content items with MVC is done by using the C# APIs – the Native API and the Fluent API.
In addition, you can access system APIs. There is no limitation to the APIs, because the MVC frontend is in the same application as Sitefinity CMS itself.
With the .NET Core framework, the available APIs are only the content APIs, served through the OData REST services.
For more information about querying content, see REST SDK on Sitefinity GitHub repository.
Frontend frameworks
Both MVC and .NET Core frameworks use the Bootstrap framework for building a mobile-friendly frontend.
For more information, see Client-side development » JS frameworks and CSS frameworks.
Reference source for built-in widgets
As with the MVC widgets, the .NET Core widgets are publicly available in Built-in .NET Core widgets on Sitefinity GitHub repository.