In this article, we look at the internals of Wisej.NET as an alternative to traditional ASP.NET for web development, particularly in the context of migrating legacy Windows Forms applications to the web.
Introduction
In a previous article, we analyzed the general theme of migrating legacy Windows Forms applications to the web. A common practice entails wrapping up the backend of the application in an API layer and exposing it—altogether—as a service in a microservices architecture or a more traditional tiered (e.g., ASP.NET Core) application. In both cases, the sore point is the full redesign of the user interface with HTML5, CSS and JavaScript (or comprehensive frameworks such as Angular or React). Another nontrivial point to add up is that when you choose a modern frontend layer, the mapping between UI connectors and legacy backend endpoints may not be as direct as it should be. The need of yet another intermediate query layer (e.g., GraphQL) emerges, adding costs and effort to the final bill.
In this context, Wisej.NET represents an alternate, and fairly unique, option.
Enter Wisej.NET
At first glance, Wisej.NET looks like yet another library of controls and components for allegedly rapid ASP.NET-based web development. True, but not exhaustive. Actually, Wisej.NET is a full platform tightly integrated with Visual Studio aimed at building and debugging ASP.NET Core applications. To qualify an otherwise conventional ASP.NET Core application as a Wisej.NET application, you just need to attach a custom piece of middleware in the startup.cs file.
app.UseWisej();
As Wisej.NET is ultimately also a library of tailormade components, you also need to reference a client-side framework that will drive any further interaction between the client and the server environment.
<script src="wisej.wx"></script>
Wisej.NET supports various types of web templates that ultimately result in prepackaged projects for a number of scenarios: plain web application but also web desktop application, web page application and user control library.
In which way is Wisej.NET different and relevant?
The programming model provided by Wisej.NET mirrors the desktop Windows application development model. Writing a native Wisej.NET application comes much smoother if members of the team have past experience in Windows Forms or WPF programming and are just looking to shift towards web application development. Wisej.NET simplifies numerous intricacies linked to conventional web development tools like HTML, CSS, and JavaScript. By design, the result of this effort of streamlining development is a programming model that closely resembles Windows Forms.
Even though Wisej.NET is a component-centric framework to craft modern and up-to-date web applications, it deliberately abstracts the reality of HTML, CSS and JavaScript coding to a higher-level programming model, more centered on a plain business-oriented action/reaction scheme rather than on deep knowledge of the implementation details of today’s mainstream front-end technologies.
The Perfect Use-Case
A Wisej.NET application is based on a container named Form. The Form is a collection of visual elements each of which holds a physical position within the container and exposes a number of visual and nonvisual properties. The Visual Studio dedicated environment supplies a toolbox of components to create any necessary markup in a GUI-driven way. Any client/server interaction takes the form of an event triggered on a visual component that some handler will process.
All handlers are programmed in a companion class file that goes hand-in-hand with the Form container. This code-behind class has the same relevance of a controller class in a plain ASP.NET Core MVC application. Put another way, the set of all code-behind classes of a Wisej.NET application form the presentation layer of the new web application. From there, you can simply connect the public endpoints of your existing Windows Forms application backend or create a bunch of new layers (e.g., application, domain, infrastructure as in domain-driven design).
Wisej.NET can be used to build any classic or single-page web application but its primary use-case remains the migration of a Windows Forms legacy application to a modern, highly interactive and responsive web application.
At the beginning of the .NET development era, the vast majority of developers were coming from client/server development and Web Forms for the web, and Windows Forms for desktop, provided a unified programming model that made knowledge of web technologies little or no relevant at all. A lot changed since then, and the abstraction layer on top of raw web development became progressively thinner. UI frameworks such as Bootstrap made a good attempt of raising the abstraction again but all they achieved was graphical. New conceptual components were born (e.g., navbar, input groups, dropdown menus) but still requiring explicit tons of HTML and CSS and completely devoid of behavior.
Wisej.NET brings the clock back to the time in which programming web applications shielded developers from having a significant grasp of web technologies. It’s a pleasant discovery for the newest generations of programmers and a healthy return to the origins for those still engaged in legacy Windows Forms applications.
A Look at the Internals of Wisej
Wisej.NET is a web development framework with the following unique characteristics.
- Component-based
- Single Page application
- Abstracted frontend technologies
- Real-time updates to UI
You assemble your Wisej.NET applications using various pre-built controls and components in a comfortable Visual Studio shell. This speeds up development and ensure consistency in design. The resulting Wisej.NET application typically follow a single-page application architecture, where only parts of the page are updated dynamically, leading to a smoother user experience. No in-depth know-how of front-end technologies such as HTML, CSS, and JavaScript is strictly required. This is advantageous if the team is more comfortable with back-end technologies and want to avoid deep involvement in front-end development. Finally, Wisej.NET provides real-time updates, allowing you to create interactive applications that can update in real time without requiring full page refreshes.
The last point is fairly interesting. The behavior of a typical Wisej.NET application, in fact, internally resembles closely the behavior of an ASP.NET Server Blazor application. (See Figure 1.) In a Blazor application, after an initial negotiation between the browser and the application backend, it’s a continuous exchange of web sockets packets transmitting request details and receiving DOM updates.
FIGURE 1 – The ASP.NET Server Blazor architecture
The similarity with the ASP.NET Server Blazor architecture ends at the layout level, as the exchange protocol, including format of data sent and received, is proprietary.
What About Plain ASP.NET Core?
A Wisej.NET application is therefore an ASP.NET Core application. Why not use ASP.NET Core then? There are two main debatable points. ASP.NET has a large and active community, which means you can find plenty of resources, tutorials, and libraries to support your development. Wisej.NET is a proprietary product with excellent documentation and tutorials but nowhere near to the community of a general-purpose web platform made in Microsoft as it is ASP.NET. On a much more technical tone, it should be noted that ASP.NET allows you to have more direct control over the front-end technologies used in your application. This can be beneficial if you have specific design or functionality requirements but detrimental in the perspective of rapid application development. And quite problematic if you have a legacy Windows application to turn into a web application.
Wisej.NET runs on top of ASP.NET Core but provides its own programming model, much closer to ASP.NET Web Forms than to ASP.NET MVC. As a result, it’s about two fairly different programming platforms whose only point in common is the programming language whether C# or Visual Basic.NET. The way you design the presentation layer and connect a client event to a server-side handler is radically different and so it is for the startup of the application and a number of configuration aspects.
A Wisej.NET application blinks to the application internal organization of ASP.NET Web Forms and uses the ASP.NET Core hosting runtime just to inject its own middleware and gain access to the server file management.
It’s not a matter of voting what’s better and what’s worse: it’s two different things that do the same job of building modern web applications. Of these two platforms, you have to choose one. Which one, then? Not surprisingly, it depends on your needs and your skills.
A Thoughtful Choice
The first decision point is whether you are looking for building a new application from scratch or migrating an existing ASP.NET Web Forms or Windows Forms application. In the latter case, Wisej.NET represents by far the primary option to evaluate. It may still not be ideal for you, but it’s definitely an option you might want to check. On personal experience, a large Windows Forms application with a few custom painting functions has been made deployable on the web in days by a small team of two people with no external help from consultants and only based on publicly available documentation.
What kind of people?
They were experienced and seasoned developers with a solid database background and a technical learning path rooted in the Web/Windows forms model. We were so happy that started considering the option of using Wisej.NET also for newer projects to build from scratch or evolve from a native ASP.NET Core foundation.
In doing so, though, we found out that for developers with no previous exposure to the Forms-based programing model of the early 2000s the Wisej.NET model looked weird at the minimum. Nothing that a brilliant developer can’t grasp in weeks but still a new learning path to go through.
In summary, choosing between Wisej.NET and ASP.NET depends on your specific needs and background. If you're more comfortable with desktop development and want a component-based approach with real-time updates, Wisej.NET might be a good fit. On the other hand, if you're looking for a more flexible and versatile framework with a strong community and integration with Microsoft technologies, ASP.NET could be the better choice. Always consider the current state of the technologies and your project requirements when making a decision.
If you want to learn more about Wisej.NET in comparison to Blazor, you may want to check out this article: