Released DotVVM 3.1

Published: 7/23/2021 2:03:41 PM

We are happy to announce that we published a new release of DotVVM few days ago – DotVVM 3.1. It brings many improvements of features introduced in DotVVM 3.0, and allows you to do more things on the client-side.

Type inference for lambda arguments

In DotVVM 3.0, we introduced support for lambdas in data-binding expressions, but DotVVM could not figure out types of the parameters from the method signature.

From DotVVM 3.1, it can infer the types automatically, so now you can use LINQ with the same level of comfort as in C#:

<!-- DotVVM 3.0 -->
<dot:GridView DataSource="{value: Customers.Where((CustomerDTO c) => c.Name.Contains(Filter))}" ... />

<!-- DotVVM 3.1 -->
<dot:GridView DataSource="{value: Customers.Where(c => c.Name.Contains(Filter))}" ... />

More JavaScript translations

Not all expressions are supported in value and staticCommand bindings – DotVVM needs to translate the data-bindings to JavaScript, so there is only a limited set of methods and syntax constructs that are supported.

In DotVVM 3.1, the set of supported methods was widely extended. You can now use:

  • subset of LINQ methods – Any, All, Concat, Distinct, FirstOrDefault, LastOrDefault, Min, Max, OrderBy, OrderByDescending, Skip, Take, ToArray, ToList
  • List<T> operations – Add, AddRange, Clear, Insert, InsertRange, RemoveAt, RemoveAll, RemoveRange, Reverse, including custom extension methods for more complex operations – AddOrUpdate, RemoveFirst and RemoveLast
  • Dictionary<K, V> operations – assigning via indexer, Clear, ContainsKey, Remove
  • String methods – Contains, StartsWith, EndsWith, IndexOf, LastIndexOf, IsNullOrEmpty, Split, Join, ToLower, ToUpper
  • Math methods – Round, Floor, Ceiling, Trunc, Min, Max, Pow, Exp, Sqrt, Abs, Sign, Sin, Cos, Tan, Log, and more

If you provide custom translations for extension methods, DotVVM resolves them based on the @import directive.

String interpolation

You can now use the string interpolation syntax in data-binding expressions – it allows to easily format values:

{{value: $"Send the check for {Price:c} to {Name} ({Street}, {City}, {ZipCode}, {State})"}}

FileUpload doesn’t need iframe

Because of the support of IE9 in first versions of DotVVM, the FileUpload control was rendering an iframe which was responsible for uploading the file to the server on the background. Since the lowest supported version of IE is now 11, we could get rid of this ancient relic and upload the file on the background using JavaScript XHR object.

Reimplemented the command-line interface

DotVVM CLI is a tool which mainly helps DotVVM developers who don’t use Visual Studio 2019 or 2017 – it allows to add new DotHTML pages in the project, and more.

We plan to use for more things in the future, like generate of stubs for automated UI tests, and more. Because of this, we’ve reimplemented the tool and prepared an infrastructure that allows extracting DotVVM app configuration to be used in other command-line tools.

We’d be happy for any feedback – let us know your thoughts or questions on our Gitter chat.

You can find the full list of changes and fixed in the Release notes.

What’s next

We’ve already started working on DotVVM 4.0 – its main theme will be “let’s make it easier to build custom controls”. We plan to release this version by the end of this year, and there will probably be DotVVM 3.2 some time in between. Stay tuned and follow us on Twitter and YouTube so you won’t miss any news.

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.