Software:DotVVM

From HandWiki
DotVVM
DotVVM logo.svg
Developer(s)RIGANTI and community
Initial releaseJune 11, 2015; 8 years ago (2015-06-11)[1]
Stable release
4.0.2 / March 28, 2022; 23 months ago (2022-03-28)
RepositoryDotVVM Repository
Written inC# and TypeScript
PlatformWeb platform
TypeWeb framework
LicenseApache 2.0
Websitedotvvm.com

DotVVM is a web framework for ASP.NET and ASP.NET Core that implements the Model-View-ViewModel pattern. It is free, open-source, and maintained by RIGANTI and a community of contributors. DotVVM handles back-end by implementing a custom templating language, and front-end by relying on Knockout. The framework is a member project of .NET Foundation.[2]

Features

DotHTML

DotVVM allows declarative specification of a view using a templating language derived from HTML called DotHTML. [3] Similarly to ASP.NET Razor, the language syntax contains directives and allows C# expressions in certain contexts. The language implements two-way data bindings using C# expressions.[3] These expressions are internally translated into Knockout bindings. [4]

The following example displays the text Hello, User! and counts the number of times the user clicked on a button.

public class ExampleViewModel
{
    public string Name { get; set; } = "User";

    public int ClickCount { get; set; }

    public void Increment()
    {
        ClickCount++;
    }
}
@viewModel ExampleViewModel

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
  </head>
  <body>
    <h1>Hello, {{value: Name}}!</h1>
    <p>You've clicked the button {{value: ClickCount}} times.</p>
    <dot:Button Click="{command: Increment()}" Text="Increment" />
  </body>
</html>

Controls

Controls are reusable components that encapsulate a part of a view (e.g. an input field, image gallery, list of links, etc.). In DotHTML, controls are seen as elements with a registered namespace prefix and the control name (e.g. dot:TextBox stands for DotVVM.Framework.Controls.TextBox). DotVVM supports three types of controls: [5]

  • Markup controls – defined using DotHTML.
  • Code-only controls – implemented in C# using a low-level API.
  • Composite controls – implemented in C# by combining existing controls.

Page lifecycle

DotVVM viewmodels and controls have a lifecycle which can be observed in the Init, Load, and PreRender back-end events.[6][7]

  • Init – invoked after the viewmodel has been instantiated.
  • Load – invoked during a postback after the viewmodel has been populated by data sent from the client.
  • PreRender – called after all commands have been executed but before the view is converted into HTML, viewmodel serialized into JSON and both sent to the client.

History

DotVVM was initially conceived as an alternative to ASP.NET MVC after Microsoft decided not to include ASP.NET Web Forms in ASP.NET vNext.[8][9][10] The first prototype has been built by Tomáš Herceg and presented at a developer conference in Prague under the name Redwood.[8] The project has been open-source since the prototype. The next year, Redwood has been renamed to DotVVM and publicly released on NuGet.[11]

Major versions
Version Release Date Note
0.6.0-pre 2015-06-11 First public release[1]
1.0.0 2016-07-03 First stable release[11]
1.1.0-rc 2016-12-28 Added support for .NET Core[12]
2.0.0 2018-05-25 REST API bindings, static command bindings [13]
3.0.0 2021-03-29 Introduces JavaScript commands and public TypeScript API[14]
4.0.0 2022-03-22 Dropped support for Internet Explorer, introduces composite controls[15]

Licensing

The framework, its default set of controls, as well as all the controls contributed by the community are licensed under the Apache 2.0 license. However, the Pro version of the DotVVM Visual Studio extension and the Business and Bootstrap sets of controls are proprietary and available only under a commercial license.[16]

References

  1. 1.0 1.1 "DotVVM 0.6.0-pre". https://www.nuget.org/packages/DotVVM/0.6.0-pre. 
  2. "DotVVM: Component-based MVVM framework for ASP.NET". https://dotnetfoundation.org/projects/dotvvm. 
  3. 3.0 3.1 "DotHTML markup overview". https://www.dotvvm.com/docs/latest/pages/concepts/dothtml-markup/overview. 
  4. "Adding interactivity using Knockout binding handlers". https://www.dotvvm.com/docs/4.0/pages/concepts/control-development/interactivity. 
  5. "Control development overview". https://www.dotvvm.com/docs/4.0/pages/concepts/control-development/overview. 
  6. "Viewmodels overview". https://www.dotvvm.com/docs/4.0/pages/concepts/viewmodels/overview. 
  7. "Code-only controls". https://www.dotvvm.com/docs/4.0/pages/concepts/control-development/code-only-controls. 
  8. 8.0 8.1 Herceg, Tomáš (2014-05-12). "Proč jsem se rozhodl napsat Redwood". https://www.dotnetportal.cz/blogy/3/Tomas-Herceg/7433/Proc-jsem-se-rozhodl-napsat-Redwood. 
  9. .NET Team (2014-05-12). "The Next Generation of .NET – ASP.NET vNext". https://devblogs.microsoft.com/dotnet/the-next-generation-of-net-asp-net-vnext. 
  10. Herceg, Tomáš (2016-04-19). "Náš rok s DotVVM". https://www.dotnetportal.cz/blogy/3/Tomas-Herceg/8494/Nas-rok-s-DotVVM. 
  11. 11.0 11.1 Herceg, Tomáš (2016-07-04). "DotVVM 1.0 RTM is here!". https://www.dotvvm.com/blog/5/DotVVM-1-0-RTM-is-here-. 
  12. Lukeš, Stanislav (2016-12-29). "DotVVM 1.1 RC". https://github.com/riganti/dotvvm/releases/tag/v1.1-rc. 
  13. Jež, Adam (2018-08-12). "DotVVM 2.0.0". https://github.com/riganti/dotvvm/releases/tag/v2.0.0. 
  14. Herceg, Tomáš (2021-04-03). "DotVVM 3.0". https://github.com/riganti/dotvvm/releases/tag/v3.0. 
  15. Lukeš, Stanislav (2022-03-23). "DotVVM 4.0". https://github.com/riganti/dotvvm/releases/tag/v4.0.0. 
  16. "DotVVM Products". https://www.dotvvm.com/products. 

External links

Category:Web frameworks