In this post we will take a look at some of the top features in the newest edition of ASP.net.
ASP.NET Core on Multiple Platforms
ASP.NET and the .NET framework are targeted towards the
Windows platform. On the other hand, ASP.NET Core is developed to support
multiple platforms including Windows, Mac, and Linux. ASP.NET Core is a part of
.NET Core—a new modular framework that supports multiple platforms. This also
means that, unlike ASP.NET web applications, primarily run under IIS, the
ASP.NET Core applications can run under non-IIS Web servers. Figure 1 shows the
role of the .NET Core and ASP.NET Core.
Role of Project.json
ASP.NET Core uses a special file Project.json for storing
all the project-level configuration information. Project.config can store many
configuration settings, such as references to NuGet packages used in the
project and target frameworks.
Tag Helpers
In ASP.NET MVC 5, you used HTML helpers such as BeginForm(),
LabelFor(), and TextBoxFor() to render forms and form fields. You can continue
to use HTML helpers in ASP.NET Core, also. But there is a better alternative:
Tag Helpers. Tag helpers take the form of standard HTML tags with certain
special asp-* attributes added to them
View Components
In MVC 5, you used partial views as a means to reuse markup
and code. ASP.NET Core introduces View Components—a more powerful and flexible
alternative. A view component consists of a class typically inherited from
ViewComponent base class and a view file containing the required markup. This
programming model is quite similar to the one used by controllers and views. It
allows you to separate code and markup from each other—code in the view
component class and markup in a view. Once created, you can use a view
component on a view by using the @Component.Invoke() method.
Single Programming Model for MVC and Web API
In MVC 5, controllers inherit from the
System.Web.Mvc.Controller base class. And, Web API 2 controllers inherit from
System.Web.Http.ApiController. In ASP.NET Core, both of these frameworks are
merged into a single framework. Thus, under ASP.NET Core, an MVC controller and
Web API controller both inherit from Microsoft.AspNet.Mvc.Controller base
class. You then can configure aspects such as HTTP verb mapping and the routing
of the controllers as desired.
No comments:
Post a Comment