DotVVM 1.1 RC Released

Published: 12/27/2016 11:00:00 PM

We have just released DotVVM 1.1 RC package on the official NuGet feed. It is a feature complete version with .NET Core support and several new features. Currently, we are working on the documentation which is not updated yet.

Together with this release, we have also pushed Bootstrap for DotVVM 1.1 RC which supports both .NET Core and OWIN versions.

Also, we will release an updated version of DotVVM for Visual Studio 2017 with support of the new CSPROJ format, which has changed two weeks ago.

 

What’s New

The biggest news for DotVVM 1.1 is of course the .NET Core support. However, there are several hidden gems to make your life easier.

 

1. Conditional CSS Classes

If you need to assign multiple CSS classes to an element and be able to change them, it is a real pain. You have to write complicated expressions to concatenate the classes which should be present and separate them by spaces.

<div class="{value: (IsRed ? 'red' : '') + ' ' + (IsGreen ? 'green' : '') + ' ' + (IsBlue ? 'blue' : '')}">…</div>

We have introduced a new syntax which can toggle CSS classes.

<div class-red="{value: IsRed}" class-green="{value: IsGreen}" class-blue="{value: IsBlue}">…</div>

DotVVM automatically translates these class-* attributes to Knockout “class” bindings.

 

2. Filters on Custom Presenters

It is very convenient to use for example the [Authorize] attribute on a viewmodel to deny the anonymous users. Now, you can use the filters also on custom presenters.

We had to do some changes in the filters in DotVVM (e.g. to make them async). We have also moved the ActionFilterAttribute methods into several new interfaces so you can create filters that target only some events of the HTTP request lifecycle, not all of them. The ActionFilterAttribute class functionality however stays the same.

 

3. Hiding GridView Columns

The GridView control will get some new features in the future and in 1.1 release, there is an option to control the visibility of its columns using the new Visible property.

 

4. Route Constraints

We have implemented the same thing you may know from MVC or ASP.NET Web API – the route parameter constraints.

    config.RouteTable.Add("Article", "article/{Id:int}", "Views/Article.dothtml");
    config.RouteTable.Add("NewArticle", "article/new", "Views/NewArticle.dothtml");

The first route will be matched only if the Id parameter is a number. If the URL will look like article/new, it will be matched by the second route.

 

5. Boolean properties without ="true"

Instead of writing <dot:Button IsSubmitButton="true" />, you can only write <dot:Button IsSubmitButton />. For boolean control properties, you don’t have to write ="true".

 

6. @import Directive

This directive allows to import C# namespaces for @resource or @staticCommand bindings.

@import MyApp.Resources <-- namespace is imported
@import RS=MyApp.Resources <-- namespace is aliased as RS
@import Resources=MyApp.Resources.DetailPageResources <-- type is aliased as Resources

You can also import the nemaspaces globally in DotvvmConfiguration.Markup.ImportedNamespaces.

All directives also support generic types with C# syntax:

@viewModel System.Collection.Generic.List<MyApp.ViewModels.SomeViewModel>

Because of this change, the @resourceNamespace and @resourceType directives had to be deprecated and will not work any more.

 

7. EnvironmentView and ClaimView Controls

These controls can display or hide parts of markup depending on the environment in which the application runs (Development, Production), or a claim the current user identity contains.

 

8. New Resource System

We had couple of reasons to rewrite the resource system. It has to support several types of resources – files in local filesystem, files embedded in some assembly, remote resources loaded from CDN etc.

In 1.1 RC, DotVVM renders the following URLs for resources instead of the old ugly ones:

Old URL format: /dotvvmEmbeddedResource?name=DotVVM.Framework.Resources.Scripts.knockout-latest.js&amp;assembly=DotVVM.Framework
New URL format: /dotvvmResource/{hash}/{resourceName}

We also support integrity checks and fallback locations (for resources that are by default loaded by CDN, but there is an alternative local file in case the CDN is down).

You can find more information in the pull request on GitHub.

 

Breaking Changes and Migration Guide

Because there are more tiny breaking changes, we have created a new documentation page to cover all steps required to upgrade from DotVVM 1.0 to DotVVM 1.1.

 

DotVVM Community Standup #1

We have also create a short video on how to upgrade our sample Checkbook app to DotVVM 1.1 RC.

 

 

DotVVM Business Pack is Coming Soon

In January 2017 we are releasing the first version of DotVVM Business Pack. It will bring a lot of new and powerful controls, including the WYSIWYG editor, GridView with advanced features like column reordering, filtering, export to XLS and PDF and much more.

Stay tuned and follow us on Twitter so you won’t miss it out.

 

Plans for 1.2

After we finish 1.1 RTM, we have several things in our backlog already planned for version 1.2. Here are the most interesting ones:

  • The serverValue binding will evaluate the expression on the server and render it directly in the HTML output.
  • The staticCommand binding will get a lot of enhancements – viewmodel patching and dependency injection support.
  • We’ll support REST API calls from the bindings. It is definitely the biggest and most interesting feature to come.
  • We’ll finish Selenium Test Helpers we have already written about.
  • We’ll also allow to build DotVVM apps easily without Visual Studio. Our DotVVM CLI will allow to create a new project, add new pages and viewmodels, precompile views to make sure they don’t contain any errors and much more. Also, we’ll release an extension for Visual Studio Code with basic IntelliSense and syntax highlighting.
  • The GridView control will get several new features like the insert row and keyboard support.

You can watch the features or join the discussions on GitHub.

Tomáš Herceg

I am the CEO of RIGANTI, a small software development company located in Prague, Czech Republic.

I am Microsoft Most Valuable Professional and the founder of DotVVM project.