Few months ago I wrote a post about how to use the new InMemoryDbContext of Entity Framework Core in our unit tests and substitute the real context with an in-memory implementation, avoiding to connect to the real database. Now that Entity Framework Core 2.0 has been released, I upgraded my project and I found a... Continue Reading →
Performance improvements in Entity Framework 6.2
Once Entity Framework was released few months ago, the first question in my mind was: why Microsoft released a new version of EF6 when the main new branch is EF Core? What the necessity that force the team to release a new version could be? Well, EF 6.2 contains a bunch of new improvements, for... 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 →
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 →
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 →
Repository pattern with Autofac
The repository pattern is one of the most popular patterns used in the applications architecture. With Autofac we are able to manage the dependencies and the lifecycle of the repositories in our application. So let's starting with the implementation of a basic respository example, then we proceed with the Autofac configurations and with the test... Continue Reading →
Register a singleton service with Autofac
Autofac is a popular and very useful IoC container, a tool that help us to manage the dependency injection in our application. What we want from a IoC container is the ability to instantiate the objects needed in different contexts and situations and define configurations, without worry about who and when instantiate these objects. Of... Continue Reading →