Singleton pattern gives a way of ensuring that there is only a single instance of a particular object – but why has the singleton become an anti-pattern? Well, the main issue with singleton is that it becomes very difficult to test since it is very likely that it’s tightly coupled to a something within the system – it’s just the nature of the singleton pattern, since it has to be able to create itself, and in order to do so, it needs to be able to gather everything it depends on by itself – not to mention issues with thread-safety if not done right.
Last week, I had to start a .NET Project that requires a database – our shared server however only provides MySQL as a database solution (Low cost solution has its price eh?).
Let’s have a quick look at how to get started with MySQL and EF6 with Code first approach.