This was initially planned as the last post of this series because this also was the last part of the talk about customizing ASP.NET Core I did in the past. See the initial post about this series. Now I have three additional customizing topics to talk about.
In this tenth part of this series, I’m going to write about TagHelpers. The built-in TagHelpers are pretty useful and make pages prettier and more readable. Creating custom TagHelpers will make your life much easier.
In this blog post, we’re going to explore a simple ASP.Net Core CQRS Web API project. The code for this tutorial exposes a demonstrative API to manage a blog.
The source code is available on my GitHub account.
I recently wanted to do a very quick proof of concept, regarding the use of setInterval versus setTimeout after reading that setTimeout was referable if you were calling the same function very rapidly. I thought I’d note down my journey from File -> New Project to having the POC running so that, next time, I don’t have to re-lookup the various parts.
File -> New Project
If you create a brand new ASP.NET Core 2.1 project, select the empty project, and then run the generated code, you’ll see this:
ASP.NET Core offers two different locations for files:
Content root – this is where application binaries and other private files are held.
Web root – this is where public files are held (wwwroot folder in web project).
By default, web root is located under content root. But there are also deployments where web root is located somewhere else. I have previously seen such deployments on Azure Web Apps. It’s possible that some ISPs also use different directories in trees for application files and web root.
During one of my ASP.NET Core classes I made a demo about how to read GPS coordinates from photo and display location on a map. I took my favorite photo of a beer kiosk in Krakow and displayed the location of this kiosk on a map. This blog post describes my experiment on getting GPS coordinates from EXIF data in an ASP.NET Core application.
Wikipedia defines EXIF (Exchangeable image file format) as a standard that specifies the formats for images, sound, and ancillary tags used by digital cameras (including smartphones), scanners, and other systems handling image and sound files recorded by digital cameras. Most of modern devices used to take photos save meta information in EXIF format to photos. It’s great but be aware – not all people may use this information in good purposes.
Finally, we have a new major version of Angular, version 7. The reason I use the word “finally" is not just because people were waiting for the latest major release of Angular, but also because there were quite a few rumors about the features Angular 7 would offer. Especially since the April Fool’s article published with the title, "Top 4 Changes Coming in Angular 7.0."
The Angular team officially announced Angular 7 just a few days back, and Angular 7 has introduced some pretty awesome features, like improvements in Angular Material, Performance improvements, and CLI improvements to name a few.
This post is a little late this time. My initial plan was to throw out two posts of this series per week, but this didn’t work out since there are sometimes some more family and work tasks to do than expected.
Anyway, we keep on customizing on the controller level in this, the ninth, post of this blog series. I’ll have a look into ActionFilters and how to create your own ActionFilter to keep your Actions small and readable.
While I am a big fan of using Autofac to serve as the framework for making Inversion of Control (IoC) and Dependency Injection (DI) work in an application, it is quite convenient in simple projects to use the built-in dependency injection in ASP.NET Core.
While it’s simple to replace the default one with Autofac, the default one is often sufficient. Unless it’s not!
In the last post about OutputFormatters I wrote about sending data out to the clients in different formats. In this post, we are going to do it the other way. This post is about data you get into your Web API from outside. What if you get data in a special format or what if you get data you need to validate in a special way. ModelBinders will help you handle this.
ModelBinders are responsible for binding incoming data to specific action method parameters. It binds the data sent with the request to the parameters. The default binders are able to bind data that are sent via the QueryString or sent within the request body. Within the body, the data can be sent in URL format or JSON.
As a relative newcomer to the web front-end, one thing that always surprised me was how many moving parts you need to get something running. This is probably true elsewhere (i.e. in backend development and desktop development) but we just do a better job of hiding it. In the past, people writing web-pages have always had an uneasy relationship with Microsoft. Maybe it started in the late ’90s when, in order to win the battle of the browsers with Netscape, Microsoft started giving its product away. Since then, IE has become more and more bloated, as it had to support 10 years worth of old technology, and people have had to ensure it still worked on IE 6 and 7. But now things are different, Microsoft is a rebranded company and nobody hates them anymore… and when you create a brand new ASP.NET Core 2.1 project, you can use npm to install client-side packages, use them in your web page, and it all just works — end of the post.