.NET 8 Preview 2: QuickGrid, WebAssembly Boost for Blazor
.NET 8 Preview 2 was announced today (March 14), shipping just three weeks after Preview 1, which was notable for a native Ahead-of-Time (AOT) compilation upgrade and the new "Blazor United," a project that melds mix-and-match server-side and client-side rendering functionality.
While Preview 2 introduces some new library functionality, the Blazor side of things gets a high-performance grid component for displaying data in tabular form,
It's "built to be a simple and convenient way to display your data, while still providing powerful features like sorting, filtering, paging and virtualization," said Daniel Roth, principal program manager for ASP.NET, the web-dev part of .NET.
QuickGrid demo site explains its purpose isn't to replace advanced datagrid components such as those from commercial component vendors, but rather:
- To provide a convenient, simple, and flexible datagrid component for Blazor developers with the most common needs
- To provide a reference architecture and performance baseline for anyone building Blazor datagrid components. Feel free to build on this, or simply copy code from it.
Another improvement is a boost to BlazorWeb WebAssembly (client-side Blazor) performance with the jiterpreter, a new .NET 8 runtime feature that enables partial just-in-time (JIT) compilation support in the .NET IL interpreter to achieve improved runtime performance.
Blazor WebAssembly apps are able to run .NET code in browser thanks to a small .NET runtime implemented in WebAssembly that gets downloaded with the app. This runtime is a .NET IL interpreter that is fully functional, reasonably small in size, and allows for fast developer iteration, but lacks the runtime performance benefits of native code execution through just-in-time (JIT) compilation. JITing to WebAssembly requires creating new WebAssembly modules on the fly and instantiating them, which poses unique challenges for the runtime. Blazor WebAssembly apps can instead choose to compile ahead-of-time (AOT) to WebAssembly to improve runtime performance but at the expense of a much larger download size. Since some common .NET coding patterns are incompatible with AOT, the .NET IL interpreter is still needed as a fallback mechanism to maintain full functionality.
By optimizing the execution of interpreter bytecodes by replacing them with tiny blobs of WebAssembly code, he said, jiterpreter -- while not a full JIT implentation -- speeded up low-level operations and higher-layer features like JSON serialiation.
As far as the general .NET 8 preview, Alexandra Barry, product manager for .NET Team/NuGet, said it comes with "a short, but exciting array of theme updates, new features and improvements" with library functionality including new
"This release is a quick follow-up to the larger Preview 1 release," she said. "You'll continue to see many more features show up with these monthly releases. .NET 6 and 7 users will want to follow this release closely. We've focused on making it a straightforward upgrade path."
On the data-driven side of things, the successor to Entity Framework, EF Core 8, in Preview 2 gets two notable features, according to Arthur Vickers:
Support for JSON columns in SQLite databases: Vickers explained that EF7 introduced support for mapping to JSON columns when using Azure SQL/SQL Server, with this support being extended in EF8 by embracing SQLite databases. As for the SQL Server support, it includes:
- Mapping of aggregates built from .NET types to JSON documents stored in SQLite columns
- Queries into JSON columns, such as filtering and sorting by the elements of the documents
- Queries that project elements out of the JSON document into results
- Updating and saving changes to JSON documents
HierarchyId in SQL Server/Azure SQL databases: "Azure SQL and SQL Server have a special data type called hierarchyid that is used to store hierarchical data," Vickers said. "In this case, 'hierarchical data' essentially means data that forms a tree structure, where each item can have a parent and/or children." Examples of such data include:
- An organizational structure
- A file system
- A set of tasks in a project
- A taxonomy of language terms
- A graph of links between web pages
The above and other .NET 8 details can be tracked in Microsoft's "What's new in .NET 8" site.
David Ramel is an editor and writer for Converge360.