One of the most authentication protocol used today in the web application is OAuth, as you know the token-based authentication protocol, where a client send the credential for the authentication, and if all goes well it receives a bearer token that the client will use for the further requests to the server. If I want... Continue Reading →
Using adapter pattern to parse HTML with C# and AgilityPack
Recently I faced with a business requirement about extracting informations from some html pages and display them in a local application. The principal problem that I found was that the result were in html format and I needed to transform that in a c# object, in order to be able to manage the informations in... Continue Reading →
Continuous integration with Atlassian Bamboo
The continuous integration is a frequent theme in the application development, expecially in the projects with many developers involved that work on differents components of the application. Just because the developers works on different features, a process that integrate the new code frequently in project and verify that all the dependencies of that are working... Continue Reading →
Deploy a .NET project with powershell and git
In this topic I want to share my experience in writing a powershell script to compile and publish a .NET project. I use Git and a GitHub repository, so in my mind the script should restore the nuget packages, build the project with MSBuild, take the last tag (version) from the master branch of the... Continue Reading →
Mocking Entity Framework DbContext with Moq
When we have to test methods that involves Entity Framework, a typical choice that we have to face is use integration tests, with an effective database, or unit tests. If we choice the first option, with a database like SQL LocalDB, we'll have performance problems because the cost of the database creation and the data... Continue Reading →
Manage attachments chunks with ASP.NET Web Api
In the previous post I spoke about a custom MultipartFormData stream provider and how it can help us to manage some custom informations included in a request message. In that example I generated chunks form a file and I sent those to a rest service (AKA Web API) with some additional informations that were then retrieved from the... Continue Reading →
Real-time search with ASP.NET and Elasticsearch
A common problem that we are faced when we have deployed our applications is improve the performance of a page or feature. In my case for example I had a field where I could search and select a city, so the starting elements were a lot and the search was quite slow; I wanted a... Continue Reading →
Register and test per-request services with Autofac
When we develop web application, like ASP.NET applications, we often need to implement a service with some informations related to the user request, such as session/account infos. In this case, the service will be tied to the web request lifecycle and there will be an instance of the service for each request. Autofac help us to... Continue Reading →
Registering of the ASP.NET MVC Controllers with Autofac
One of the capabilities of Autofac is the integration with the ASP.NET applications. ASP.NET MVC is a framework thinked to supports the dependency injection, and so we can use Autofac to register the modules that compose the application, such as the controllers. Therefore, let's start by implementing the controllers of the application, then we 'll... Continue Reading →
Services lifetime scope with Autofac
Basically when we resolve a component with Autofac, we could register the object instance in the root container; this is not the best practice, because these components will never be disposed as long as the container lives, that normally is the lifetime of the application. Then, the root container will hold the references until the application... Continue Reading →