Skip to content →

ASP.NET vNext – Razor, Directives and Tag Helpers (Notes)

These are my notes from the ASP.NET vNext Community Standardup 3


Razor Views now support async processing out of the box.

This is particularly important for ASP.NET webpages or using Razor outside the normal MVC lifecycle.

Razor now supports incremental flushing, so that HTML can be streamed to the browser. This is enabled using a new “@await FlushAsync()” razor command that can be called within the page.


Dependency injection is now plumbed into Razor.


@inject IFoo Foo

Components can now be injected via IoC into a View


The default helpers have been removed from the base class and are now injected using the Injection mechanism. This means that you can expand your own Helpers


Use _ViewStart pages

Now _ViewStart supports directives, so that we can use the @inject directive to set global properties, _ViewStart files can be cascaded and nested.

Pre compilation is still around and will be turned on by default.


Available directives

@inject IFoo Foo

@using My.Comapny.Namespace

@inherits points to the base class

@model use this model across the lifes



Model C# class

Validation based on Attributes on Model

Razor template to generate AngularJS Template, and then client side AngularJS processes template


Tag Helpers

Provides a solution to support better HTML manipulation similar to how AngularJS manipulate HTML


<input for=”FirstName” class=”form-field” />

<tag-cloud count=”2″ />

This extension improves the authoring of Razor files and provides better intellisence.

This does not enable a server side dom, you can access the view string, but you would have to manipulate this yourself, however this is not recommended as it limits the buffering and thus speed of the page.

Intent of feature is not to become server side DOM but to improve HTML helpers with HTML style syntax.



Published in


Leave a Reply

Your email address will not be published. Required fields are marked *