Boundaries of MVVM

Published: 4/1/2017 9:07:37 AM

Two years ago, we designed DotVVM to be the only MVVM framework for web that protects people from writing too much JavaScript code. Our nice data-binding syntax together with syntax highlighting and IntelliSense in Visual Studio has delivered the best development experience for web developers ever.

Yesterday, we got a very important feedback from one of our customers:
“Guys, the framework is just awesome. It made everything much easier and faster to build, but crap – loading data in the GridView control is such a pain. Could you make something like a designer or wizard for this into your Visual Studio extension?”

As fast as we always are, one of our core developers addressed this issue in this pull request. We didn’t create a wizard because everyone knows that wizards suck, but we have implemented a fully functional SqlDataSource control that allows to load data into GridView and Repeater controls directly from the SQL database.

    <dot:SqlDataSource ConnectionString="Data Source=(localdb)\ProjectsV13;Initial Catalog=test;" 
                       SelectCommand="select Table2.[FromEmail] as [From],
                                             Table2.[ToEmail] as [To],
                                             Table2.[Subject] as [Subject] from Table2 
                                      where Table2.[ToEmail] is not null" ID="Source1" />
    <dot:GridView DataSource="{value: _dataSource["Source1"]}">
        <dot:GridViewTextColumn ValueBinding="{value: _this["From"]}" HeaderText="Author" />
        <dot:GridViewTextColumn ValueBinding="{value: _this["Activity"]}" HeaderText="Author's Activity" />
        <dot:GridViewTextColumn ValueBinding="{value: _this["To"]}" HeaderText="Recipient" />
        <dot:GridViewTextColumn ValueBinding="{value: _this["Subject"]}" HeaderText="Subject" />

We have also considered introducing the __VIEWSTATE hidden field, mostly because DotVVM is so fast on .NET Core that nobody actually believes it is still ASP.NET. The __VIEWSTATE field would allow us to deliver a well known ASP.NET user experience with typical page load times between 0.5 and 2.5 secs per HTTP request.



This is of course an April Fools’ Day joke. The pull request mentioned above demonstrates the flexibility of a new binding system that will be available in DotVVM 1.2 and which can be extended easily with custom variables, e.g. _dataSource.

Tomáš Herceg

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

I am a Microsoft Regional Director and Microsoft Most Valuable Professional.

I am the author of DotVVM, an open source .NET-based web framework which lets you build Line-of-Business applications easily and without writing thousands lines of Javascript code.