It is no news that Microsoft is working very hard on improving and bringing new features to the .NET framework or to its C# programming language. This time Microsoft is targeting web development and is focusing on ASP.NET Core, which will apparently come hand in hand with the .NET 7 version.
Some time ago Microsoft released Preview 1 of ASP.NET Core on .NET 7 and the amount of new features is great, so let’s see the new features!
New Minimal API Improvements
The first of the new features will bring improvements in minimal APIs, especially in IFormFile and IFormCollection. With this new improvement you will be able to use IFormFileand IFormCollection to handle and manage file uploads in a much easier way.
Microsoft warns that if you want to use these new functions with authentication, anti-forgery is required, but so far Microsoft has not implemented such support. However, they reassure us that it is on the roadmap of .NET 7.
Support for such requests with client certificates or cookie headers is currently inactive. Let’s take a look at the example provided by Microsoft to see this new ASP.NET Core feature in action:
The next new enhancement for the minimal APIs in ASP.NET Core comes for Steam and PipeRider.
To understand in what kind of scenario these new minimal APIs would be used, let’s imagine that we need to store data in a blob storage or queue it in some queue provider like Azure. In this case we can use Steam and PipeRider to bind the body of a request and later process it in the cloud.
However, Microsoft warns us three details to achieve a correct functioning of these minimal APIs:
- The Streamwill always be the same object as Body when ingesting any type of data.
- The Streamcannot be read again more than once (not rewindable) since by default the request body is not stored in the buffer.
- As the underlying buffers will end up being reused and discarded, both Streamand PipeRider cannot be used outside of the action handler.
The last improvement in the minimal APIs that Microsoft brings in this Preview 1 is about JSON configuration. Through ConfigureRouteHandlerJsonOptions we will be able to manually configure the options and settings of the minimal API endpoints using JSON.
This improvement has been introduced mainly, as Microsoft says, to avoid confusion with Microsoft.AspNetCore.Mvc.JsonOptions.
New client source generator for SignalR
This is the next new feature that ASP.NET Core will bring in .NET 7. This new source code generator for SignalR introduced by Microsoft has the ability to generate code (both sending and receiving) strongly typed based on developer-defined interfaces.
This especially applies to SignalR hub interfaces, there would be no need to use them in loosely-typed methods, we now have the option to reuse them in the client. At the same time, there is the possibility of implementing an interface that contains the methods and at the same time the client can take advantage of that interface to call any method that is part of the hub.
The good thing is that Microsoft has let us see the use and operation of this new SignalR generator. Let’s see how Microsoft uses it:
- First you need to add a reference to AspNetCore.SignalR.Client.SourceGenerator.
- Then the following classes must be added to the project: HubClientProxyAttributeand HubServerProxyAttribute :
The next step is to add a static partial class and write the following static partial methods together with the attributes HubServerProxy and HubClientProxy in this way:And finally, we would use the partial methods and that’s it:That’s it, that’s how easy it is to use the new SignalR client source generator.
Razor Pages and MVC views with nullable models
We continue with the next improvement brought by Microsoft. This time they have focused on improving the user experience of the checks and for this, they have implemented the nullable view for the checks that are made of null state of any ASP.NET Core application. In this case this is the example that Microsoft provides us:
Unfortunately there are no further examples or use cases for this new feature. Hopefully Microsoft will continue to release new features and talk more about the ones already revealed.
Validate errors with JSON property names
Thanks to this new ASP.NET feature you will be able to manually configure with “SystemTextJsonValidationMetadataProvider” the validation to use the JSON property names.
Previously as the names of the properties that a model has, commonly were implementation details, managing them from a single page application was difficult.
If you want to know more about this feature, I recommend you, as always, to consult the original source: Use JSON property names in validation errors
Injection services in Blazor
Injecting services into Blazor? attributes Yes, thanks to this improvement you will be able to inject almost any type of service into custom validation attributes. To do so, the ValidationContext will be configured by Blazor to be used as a service provider.
For more information and to develop a website using ASP.NET, Hire .NET Developer from us as we give you a high-quality product by utilizing all the latest tools and advanced technology. E-mail us any clock at – email@example.com or Skype us: “hkinfosoft”.
To develop a Website using Vue.js, please visit our technology page.
Everyone knows Google’s obsession with creating different frameworks and launching a few programming languages. Dart was one of the programming languages launched by Google which was object-oriented and a web-based programming language.
One programming language named GO gained quite impressive among developers and GO. GO or GoLang was statically typed and explicit. It was a general-purpose programming language that was similar to the C programming language.
Now Google is all set to launch a new programming language called Carbon programming language. Carbon Language could serve as a successor language to C++, one that provides a simple starting point for developers to a newer language that addresses contemporary development concepts like memory safety and generics.
C++ works, but what’s the problem?
C++ has been around the block for much longer than some of us have been alive. Developed in 1982 and released in 1985, C++ has found its way into operating systems, browsers, and games.
While C++ is not the coolest kid to learn (unless you want to go down the game dev track), but it still holds a strong foothold for applications that requires performance, speed, and is a bit strapped with resource availability.
In a nutshell, C++ is a general-purpose programming language that has all the usual bells and whistles such as classes and objects, abstraction, encapsulation, polymorphism, and inheritance. It’s strongly typed, case sensitive, uses pointers, and has a massive functions library.
So, what’s wrong with C++ ?
The general criticism of C++ is that it leans towards being overly complex. IntelliSense generally sucks, no support for first-class functions and tuples, and initializer lists are considered a ‘hack’. In addition to this, there are a few quirks like duplicate syntax and operators such as the & being both a logical operator and a reference.
Then there’s the issue of each compiler vendor making up their own names and prevents linking modules from different compilers.
There’s a bag full of other problems but in short, C++ works but it has its issues.
Carbon Programming Language: An Experimental Successor To C++
Given the context, it seems reasonable to think of a new purpose-driven language that builds on the six goals for C++ and adds one more:
- Performance-critical software
- Software and language evolution
- Code that is easy to read, understand, and write
- Practical safety and testing mechanisms
- Fast and scalable development
- Modern OS platforms, hardware architectures, and environments
- Interoperability with and migration from existing C++ code
What Are The Promises Of Carbon?
Starting from the difficulties experienced in the language and in the governance, Carbon adopts a different approach for both areas.
Carbon wants to start from scratch including:
- modern generics system,
- modular code organization,
- simple syntax.
Carbon wants to be “a successor language […], rather than an attempt to incrementally evolve C++”, carbon-lang.
For this reason, it gave up on transparent backward compatibility while remaining interoperable with and migratable from C++.
Carbon wants to be more inclusive by:
- Building on open-source principles, processes, and tools. Contributing is easier and more transparent.
- Having a clear governance structure that can make decisions rapidly when needed.
- Expanding the ecosystem with tools that provide a rich developer experience (compiler, standard library, IDE tools), and tool-based upgrades
- Bridging a gap in the C++ ecosystem with a built-in package manager.
Carbon: The Language
As stated in the Goals, “Carbon is an experiment to explore a possible, distant future for the C++ programming language designed around a specific set of goals, priorities, and use cases”.
Among the presented features, it is worth mentioning:
- Introducer keywords:fn for function, var for variable declarations
- Function input parameters are read-only values
- Pointers provide indirect access and mutation
- Expressions to name type
- The namespace at the root is always local
- Public members by default. The reasoning seems to be that since you will mostly read the public functions in your API, it makes sense to expose them.
- Type checking generics
This list is by no means complete but it gives an overview of some characteristics of the language.
So, when’s the full release?
Currently, Carbon is in an experimental phase. The current roadmap is as follows:
- Release of a core working version (0.1) by end of 2022
- 0.2 in 2023
- Full 1.0 release in 2024–2025
That’s basically it for now. The documentation for Carbon is generally succinct and accessible — even to those who are not C++ developers.
Overall, it should be interesting how Google pushes Carbon once it’s fully ready. Will it be linked to all the metaverse stuff that’s up and coming everywhere? (Sort of like how Kotlin got pushed through Android development to replace Java) Or perhaps it will be linked to Android-based game development?
Whatever the future, Carbon is coming. How it plays out, we will probably find out in a few years’ time.
For more information and to develop web applications using modern front-end technology, Hire Front-End Developer from us as we give you a high-quality solution by utilizing all the latest tools and advanced technology. E-mail us any clock at – firstname.lastname@example.org or Skype us: “hkinfosoft“.