What's new in 3.0

Wisej.NET 3 is the first release of Wisej.NET that supports both .NET Framework (4.8) and .NET Core (now .NET 6, will be 7...) and runs on Windows, Linux and MacOS.

circle-check

Adding support for .NET Core and ASP.NET Core required changes to the HTTP/WebSocket layer and the implementation of a new Wisej.NET Middleware module. Everything else is fundamentally unchanged or enhanced: .NET Controls, JavaScript Widgets, Designer, Themes, Theme Builder.

We have been using Wisej.NET 3 on Linux internally on many test projects and we have run it on several Linux distributions as well as small devices like the Raspberry Pi for over a year. And we are in the process of testing it on even smaller embedded devices running custom Linux builds.

Existing Wisej.NET 2 applications should be able to run on Wisej.NET 3 mostly unchanged. Hopefully, all you need to update is the Visual Studio project formatarrow-up-right to the new "Sdk" project format.

The designer in Visual Studio is not available for the .NET Core targets and relies on the dual target approach, with the added benefit that Wisej.NET applications can be deployed on .NET Framework 4.8 on Windows and .NET Core on Windows, Linux and MacOS.

circle-info

The new Sdk project format has many properties that are not available in the project property panel. You'll have to get comfortable editing the .csproj or .vbproj files directly. See Project Properties for an example if the ones we added to our templates.

Multi Targeting

New projects can target multiple .NET platforms. When you create a new Wisej.NET 3 project, our wizard will allow you to select the target and enable certain options:

New Project Wizard

You can edit the .csproj or .vbproj at any time and change the <TargetFrameworks> tag. Just make sure that "net48" is always the first, if you want to use the designer.

Multitargeting will inevitably require the use of conditional compilation and excluding certain source code files from some platforms. In our sources we use conditional properties and partial classes to neatly separate code keeping the same class structure.

.NET 6+ Windows, Linux, MacOS

Now that Wisej.NET applications can run on .NET 6+ they are standard ASP.NET Core applications. When running on .NET 4.8 they are standard ASP.NET applications.

ASP.NET Core applications don't use System.Web anymore and are not integrated with the IIS pipeline. They are all based on OWIN and Microsoft's Kestrel. Which means that they are almost always self-hosted web applications.

circle-check

This is how you add Wisej.NET to a standard ASP.NET Core application:

triangle-exclamation

New Features

While the vast majority of the work in Wisej.NET 3 has been to split the code between .NET Core and .NET Framework, replacing all of the ASP.NET code with ASP.NET Core, we have also added some cool new features.

Download Callback

All the Application.Downloadarrow-up-right, and Application.DownloadAndOpenarrow-up-right methods have a new optional argument: a callback function, invoked when the file has been downloaded by the client.

This is a powerful new feature that allows an additional level of control that was not possible before.

Auto Layout

Wisej.NET supports all sorts of very powerful layoutsarrow-up-right (impossible to achieve with any other web platform). However, all the layouts are implemented in layout engines and are "permanent": you have to set layout properties for the children and the container manages the layout using the specific layout engine.

If you just need to apply a specific layout, or a combination of layouts, by code, without having to change containers, use the Control.LayoutChildren() methods:

  • LayoutChildren(controls, dock, viewArea, spacing, useMargins, hAlign, vAlign)

  • LayoutChildren(controls, direction, viewArea, spacing, useMargins, hAlign, vAlign)

Each method is overloaded with multiple variants and most parameters are optional using predefined values.

Calling LayoutChildren without the controls collection and without the viewArea argument, arranges all the direct children using the control's DisplayRectangle arrow-up-rightas the bounding area.

Otherwise you can specify only a subset of the child controls and define a view area to limit the layout space. You can also try this new automatic layout functionality at design time using the new AutoLayout Panelarrow-up-right.

You can call this method as many times as you need and with as many combinations of rules as you like. It doesn't change the layout engine or the layout options, it only moves and resizes the child controls according to the specified arguments.

Commanding

We have introduced a new experimental feature to extend the current data binding model to make it compatible with MAUI's Commanding arrow-up-rightapproach. In our implementation, commands work seamlessly with the existing data binding and have access to the full context arrow-up-rightof the command sourcearrow-up-right. In MAUI the command's code is limited to a single parameter.

In this first implementation, Buttonarrow-up-right and SplitButton arrow-up-righthave a new Command arrow-up-rightproperty and CommandChanged arrow-up-rightevent. The Command property can be data-bound to ICommand arrow-up-rightproperties of the data source.

When ICommand.CanExecutearrow-up-right returns false, the command source button automatically disables itself. Clicking the button invokes the method attached to the command.

Use the new Command arrow-up-rightclass or Command<T> class to wrap the implementation of a command and to cast the data item coming from the data source.

triangle-exclamation

New Interfaces

Added new interfaces that allow code to use common features across controls:

Using these interfaces eliminates the need to cast a control to the specific class.

Service Container

Wisej.NET 3 adds a new experimental feature to support the dependency injection model natively.

The Application class now is an IServiceProvider arrow-up-rightand has two new methods to manage services: AddServicearrow-up-right and GetService arrow-up-rightwith several overloads.

Using this new feature is quite simple, flexible and very powerful. Use Application.AddService() to register a service and Application.GetService() to retrieve it. Services can be added with several scopes:

  • Global. Only one instance (singleton) is shared among all sessions.

  • Session. Each session gets its own instance.

  • Transient. Each request gets a new instance.

When the services instance passed to AddService is null, Wisej.NET will automatically try to instantiate the service class on first use (on demand). As soon as the service goes out of scope, Wisej.NET will automatically dispose of it. If the service implements the IDisposable interface, it gets a call to IDisposable.Dispose()

A service can also be instantiated on demand in a callback.

Using the service is also quite simple. Regardless of the scope, the service consumer simply calls:

The return is just null if the requested service is unavailable.

DataGridView.DataRead

Our DataGridViewarrow-up-right control can handle an unlimited number of rows thanks to its built-in virtual scrolling and page caching on the client side. As the user scrolls the rows, the control manages a client-side cache of pages or rows and requests from the server only the pages that are needed to render the current view.

You can control the size of the client-side cache using the BlockSize and MaxCachedBlocks properties. When the DataGridView arrow-up-rightis in VirtualModearrow-up-right, it doesn't hold any data and can manage any number of rows with minimal memory usage. Your code provides the data as needed handling the CellValueNeededarrow-up-right and CellValuePushed arrow-up-rightevents.

However, the VirtualModearrow-up-right events are fired every single time the application code uses a cell in the grid (in VirtualModearrow-up-right the grid doesn't hold any data). Usually, implementations of a virtual DataGridView must implement some kind of cache management on the server.

The new DataRead arrow-up-rightevent makes this task a lot easier. It is fired when the client requests a page allowing an application to build and manage a small server-side cache in sync with the client scrolling, resulting in a much simpler usage of the VirtualMode arrow-up-rightevents.

DataGridView.NoDataMessage

This property has been available arrow-up-rightas an experimental feature for a while and it's now a supported property. It takes an HTML string and it displays filling the entire grid space when there grid contains no rows.

Shows like this when the grid is empty.

General Improvements

  • Rolled up all bug fixes.

  • Layout speed improvements on the client and server.

  • Refreshed all icons in designer and Theme Builder.

Last updated

Was this helpful?