The delegating handler in WebAPI is the most basic mechanism to intercept HTTP message lifecycle. We can find a very clear and useful visualisation of on WebAPI poster. We can see that message handlers is the first place in HTTP request processing which is able to read of modify the message. It is many cases when we would need to place some code before request will be executed and after. But first, we will introduce how to write that kind of handlers.
During the API creating work, it is necessary to test API calls. We can do this in many ways. One of the good method could be just using browser to enter url in address bar. However using this method we can test only GET requests. Also there is problems with setting up headers.
Other method to test HTTP requests is using cURL format and appropriate software. This is a console program, so it is very extensible and powerful. However it is a console program and it is more complicated to use and we should manage request database on our own. It can be easier.
Fortunately it exists a program Postman. It is a software for all kind of HTTP request work. It can be installed as a standalone application and as a Chrome plug in.
If we write code working with databases, usually it is beneficial to preview what SQL is used during the system use. It is the most useful when we want to use some ORM like Entity Framework. Each query executed by Entity Framework is transformed into some SQL query, the it is executed on database. Profilers is mostly use to:
– complexity check of generated SQL query
– query optimization
– checking of existence of common querying problems (e.g N+1 problem)
Integration test is used for checking the behaviour of application from interface to the database. In our case it will be used with API. It is most useful to:
– testing if correctly operate on data
– perform smoke test (checking if some part of API is working)
– simulate some types of behaviour on API server
All the tasks related to transferring knowledge would be much easier if the company manages knowledge in teams properly. It is very important in every day of work. We will describe here, how to do this effectively, starting from the beginning of work for a new employee.
One of the task during my work on AppSensor .NET library was to create a simple implementation of log provider. It was my inspiration to make some research about rules how to create a good logging system.
The first thing that is necessary before creating or even configuring is to think what is the purpose of logging. When we might need this information and how it can be useful for future application use.