Recently, one of my very old project which was working in old version of IBatis ORM comes under scanner when more than 10 transactions were passwed to it and it failed. Reason, it ws trying to hit db synchronously in a for loop to hit the DB and insert the new transaction one by one. For smaller set of transactions (<10) it was working fine but when the transaction increased, it went timed out. What I did to fix the issue to support any number of transactions is to do the trasansactions multi-threaded way. Below are the step by step details which I took and issue was resolved.
Delegates and Events in C# .NET. Simple example, self explainatory code with comments inline. Lets check it out in code behind.
The repository and unit of work patterns are used to create an abstract layer between data access layer
and the business logic layer. This can help to insulate application from changes in data store and also help in test-driven-development (TDD).
In this post, I have implemented a repository class for entity type "User" creating a repository interface and a repository class.
When we instatiate the repository in the controller, the interface will accept a reference to the object that implements the repository interface.
1. When the controller runs under web server, it receives a repository that works the Entity Framework.
2. When the controller runs under a unit test class, it receives a repository that works with either in-memory data or a mocking database which can be easily manipulated for testing.
The unit of work class wraps the work of multiple repositories by creating a single database context class shared by all.
While one of my web service was running on local IIS express, everythiing was working fine, but then I was supposed to provide cross platform team to hit the servive locally in debug mode so that they find the exact reason of error. For that I tried to change IIS express to local IIS. After making changes I noticed that it started yelling Bad Request 400. Lets see who to resolve this problem as its very common scenario that anyone case face during development. Every developer should be familiar to have a work around to such type of common issues.