How To Utilize ASP .NET in 2021












Why .NET in 2021






Disclaimer :

 I am learning full-stack web development and throughout this blog we will be using .Net web api and angular, I'm not a programming guru everything I will be sharing here is through personal experience and personal point of view.




.NET 5 will be a game changer and C# will be a really high in demand programming language in 2021 for various reasons

  • Windows Forms improvements: Developers can enforce their applications are single-instanced, meaning one instance is launched at a time.
  • RyuJIT code quality improvements: A plethora of these deal with general improvements (struct handling and more), ARM64 hardware intrinsic, and ARM64 generated code improvements that greatly reduced ARM64 code size.
  • Single file apps improvements: A new option to include native binaries and any additional content (like images) in the single-file has been added. "We've been continuing to improve Support Single-File Apps in .NET 5," Lander said. "Our goal is to enable publishing an app as one file (obviously), for Windows, macOS and Linux. We're almost there."
  • Native hosted application improvements: A contributor provided a novel new model for hosting models for .NET in native applications.
Now that we know that .NET will rock in 2021, How do we use it to build web apps ? for that matter we will be using ASP .NET Web API

What is ASP .NET Web API


ASP.NET Web API is a framework that makes it easy to build HTTP services that reach a broad range of clients, including browsers and mobile d
evices. ASP.NET Web API is an ideal platform for building RESTful applications on the . NET Framework. Unlike ASP .Net MVC, Web API uses routing based on HTTP verbs rather than URIs that contain actions. So, you can use Web API to write RESTful services that can leverage the HTTP protocol -- you can design services that are easier to test and maintain. Routing in Web API is much simpler and you can leverage content negotiation seamlessly.

To sum it up, asp.net web api is the tool we use to build APIs like the ones we used in our beginner weather apps etc..., they're basically in the form of a URL that we send requests to and receive raw data  that we can then use in our app.


Why YOU Should Use Web API

The cool thing about MVC is that you can create a full web app with just one programming language C#, however that has some downsides, your skill set would be limited to one technology and that will decrease your chances of landing an IT job. While most people use MVC that is limited to web apps. an API can be extended to any app you can imagine (desktop, mobile, web) you just need to learn an extra front end framework to kickstart your full stack title. Asp.Net MVC is used to create web applications that return both views and data here's an example of the html syntax in an MVC app



you basically insert a model as you can see above, the model represents a data structure (list, class...)
and then the data inside the model will be passed through a controller that returns the desired html view, then the html helpers will extract data from the passed class as an example :

<th>
  @Html.DisplayNameFor(model => model.StudentName)
</th>

this line will create a table heading holding the value of the StudentName property that is being held inside the Student class and as u can see this syntax is limited to only web apps but Asp.Net Web API is used to create full-blown HTTP services with an easy and simple way that returns only data, not view therefore a faster response time because obviously raw data is easier to process than a full markup syntax. this is an example of what a web api controller will look like



the [HttpGet] attribute is to determine the type of request we need to send, then we get the clients from the _context variable which is an instance from the database context and then we basically return an array of clients in a json format, that's it as easy as that, and that JSON formatted data could be used in any app therefore you must extend your skillset and learn a front-end framework then you will also be hitting two birds with a rock, you could apply for job titles that don't require asp .net as a front-end dev and you could also apply as a full-stack / back-end dev in case of rejection therefore multiplying your chances in the market. You will also have everything you need to start a startup alone if you invest enough time into it.

Why Angular




I took a course and it demanded basic hello world angular knowledge so I learned the basics a bit, and then I learned a bit further and now I'm using angular to build my first full-stack complete app. Another reason we .NET developers prefer angular is because it comes with TypeScript which is made by Microsoft and it’s a much closer language to C# than plain JavaScript. Basically you just need any front-end framework, I don't recommend vanilla JS because it's hard to manage large apps with it, some people would say master JS before transitioning to any framework but I'd say basic syntax and couple Rock Paper Scissors and Calculator apps will do. If you're stuck at which framework you'd like I'd recommend Angular or React because these frameworks are high demanded in the market and also they can be used to build web apps, Progressive web apps which are basically apps written in Angular/React, Html, CSS but could be installed on mobiles and you can also build native apps, which are apps that will run on mobiles and behave like a normal mobile app .


Final Words

Thanks for following through this blog post which is also my first blog post, If you have any feedback or any questions drop them in the comment section, Also I'm not a Senior Developer and I'm giving my honest opinion here.

If you want to support me buy yourself something from my store 



Reactions

Post a Comment

1 Comments