Released DotVVM 4.2
Published: 11/12/2023 4:21:37 PMWe are happy to announce the release of DotVVM 4.2 which brings many important improvements, and prepares the ground for DotVVM 5.0 which we’ve already started working on.
New features in the framework
DotVVM 4.2 brings several larger features:
- Validation in static commands – you can now enable validation for static commands and use validation attributes or IValidatableObject on arguments of the called method. Also, you can build and return your own model state which allows you to implement more complex validation logic. We’ve described it in a greater detail in the previous blog post and in an announcement on the community forum.
- Custom primitive types – this feature helps you with using custom types which are treated as primitive values and can thus be used in URL parameters, SelectedValue of ComboBox control, and other places. This is useful to implement for example strongly-typed identifiers which are popular anywhere Domain-Driven Design architecture is used. We also described the feature in detail in the blog post about DotVVM 4.2 Preview 7.
- ASP.NET Web Forms adapters is a simple package which helps in the scenario of modernization of legacy ASP.NET applications using DotVVM. When you are in the process of migration, some pages are still using ASP.NET Web Forms while the others are already migrated into DotVVM. However, in such case you cannot use the classic RouteLink control because it may point to pages which haven’t been migrated yet. The DotVVM.Adapters.WebForms package contains the HybridRouteLink control which is extending the built-in RouteLink with a support to point to Web Forms routes. You can use this control at the migration time, and replace it with the classic RouteLink after the migration is finished.
- Simplified JS API to manipulate with state – this is a set of functions that help reading and modifying the viewmodel from JS code. See the announcement on the community forum for more info.
- Support for Knockout deferred updates – in order to increase the client-side performance of more complex DotVVM pages, some users were turning on the Knockout’s deferred update functionality. While this functionality worked correctly in most cases (we only found some Business Pack with slight issues), this wasn’t officially supported and tested. Now we run all tests in both normal and deferred updates mode, and you can turn this mode on using config.ExperimentalFeatures.KnockoutDeferUpdates feature flag.
- Metrics and Prometheus support – DotVVM now publishes a plenty of useful metrics including the size of the viewmodel, time needed for the serialization or execution of the commands, server-side viewmodel cache, and more.
Of course, there are more smaller changes and bug fixes. You can find a complete list in the Release notes.
Bootstrap for DotVVM
The packages for Bootstrap 3, 4, and 5, support DotVVM 4.2 from the first day. If you don’t see this version on your DotVVM Private NuGet feed, make sure you have an active license (each license includes 12 months of upgrades and bug fixes since the day of purchase).
We’d like to thank the community for feedback, especially to the new Bootstrap 5 package which was completely rewritten using the new Composite Controls approach. We fixed 15 issues in various controls, and added several features suggested by the users. Please keep the feedback coming.
We are still aware of several issues in the DotVVM for Visual Studio extension and we are preparing a fix.
DotVVM Business Pack
Except for numerous bug fixes, there were also several enhancements to DotVVM Business Pack.
- DotVVM.BusinessPack.Messaging package provides a simple way to connect the DotVVM page to a SignalR Core hub and invoke commands in the page from the server. This helps adding nice real-time capabilities in the pages. We’ve created a video about making UI for long-running operations and creating a simple interface for ChatGPT using DotVVM Business Pack Messaging.
- Support for Auto UI enhances the feature of DotVVM 4.1 with a support for Business Pack controls. When you use a DateTime field in the auto-generated interface, a Business Pack DatePicker, TimePicker or DateTimePicker control will be used based on the given property metadata. Similarly, multi-select experience is done via the MultiSelect control, and so on. We’ll be happy for your feedback in order to add features to this integration.
- Support for CSS layers simplifies the life for front-end developers by wrapping the Business Pack styles in a separate CSS layer. Thanks to this, it is easier to override Business Pack styles.
- Support for bundled scripts and styles – beginning with DotVVM Business Pack 4.2, you can choose whether you want to reference chunked resources or a complete bundle in your pages. With chunking enabled, DotVVM loads just the scripts and styles for the Business Pack components that were actually used on the page. This can save some bytes, but if your pages contain many components, it is more efficient to load the entire Business Pack bundle because of caching. Chunking is typically preferred on public-facing sites or on the sites where the speed of the first page load is crucial. Now you can choose between these two modes.
- GridView filter localization – we added an option to localize filter operators (equals, starts with, and so on) using server-side styles. We are working on supporting IStringLocalizer which will be even easier.
- GridView filters support simple expressions in column values – if you bind a column not to just a property but to a simple transform which DotVVM can evaluate in both ways, e. g. someDate.ToBrowserLocalTime(), it will work in GridView filters. This is useful when you store data in UTC but want to display them in user’s local time and apply this to the filters also.
- TreeView performance – we added an option to not expand child items on selecting them, and we’ve rewritten some parts of the component so when you expand a large subtree, it is now much faster.
We have also implemented editing support for GridView which can switch the control in Excel-like editor where the user can edit any cell, however this feature didn’t make it in the 4.2 release.
We also have a working prototype of grouping for GridView, however we are still working on the API of this feature so it would be more easy to use, especially with popular ORMs like Entity Framework.
Plans for DotVVM 5
The main feature of DotVVM 5 will be extensible GridViewDataSet.
Currently, the data sets support sorting and paging (filtering is added only in Business Pack via inheritance, which is not a perfect solution as it is hard to combine with other features).
- The default paging supports only one mode (PageIndex and PageSize properties) which is not always easy to implement, especially with data sources which use token-based paging or any other method of paging. The new paging will be extensible using generics, so you will be able to plug your own implementation of paging. To make it work with the default DataPager control, the paging will need to declare capabilities (can go to the previous page, can go to a page with a specified index, knows the total number of pages, and so on). Based on that, the DataPager will render just the controls which make sense for the concrete data set. In the simplest case when the paging can only go forward, there will be only the Next button.
- The default sorting supports only one column. Again, we want to make it pluggable so you will be able to use multi-criteria sorting and implement your own strategy for the user to define which columns will be used in which order.
- There will be a pluggable filtering. In the framework, the filtering options will be just an empty placeholder, but we will be able to plug the Business Pack implementation of filters without using the inheritance.
The GridView and DataPager will also get a new event called LoadData which can be used to refresh the data using a static command. This will allow sorting, paging and filtering without posting the entire viewmodel back to the server.
We also plan to introduce a new pager controls, for example the AppendableDataPager which will make the “infinite” scrolling experience.
Watch us at .NET Conf!
.NET Conf 2023 is almost here – it starts on Tuesday, November 14. This year we will have a session about modernization of legacy ASP.NET apps using DotVVM by Tomas Herceg – it’s on Thursday, November 16, 9:00 – 9:30 AM UTC (1:00 – 1:30 AM Pacific Time). The session will be recorded so even if you cannot join us at this time, you will be able to watch it on demand.
As always, we will be happy to hear your feedback. Please tell us about your experience with upgrading to DotVVM 4.2 on our new community forum.
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.