In the specific case of the data access layer, I would avoid static methods for one simple reason ....
Static methods cannot implement the interface; instance methods can. Using static methods, you actually insist on coding the interface and instead code the implementation. Thus, everything that uses this level of data access is always required for this level of data access.
There are no alternative implementations, no test stubs, no dependency inversion at all. There is a dependency arrow in business logic that points to infrastructure (level of data access), whereas it should be the other way around.
In addition, it seems that this, at least, carries a great risk of having problems with the removal of resources. It may not be, but it is really easy for that. What if the developer somewhere on the road has the bright idea of extracting common lines of code into the static method and property of the class? Something like a Connection object or a DBContext ? This will create very interesting and very difficult to debug runtime errors.
On the other hand, if the repositories were instances, then they can simply implement IDisposable and make sure that the objects at the class level are correctly located.
Continuing (I think I had more objections to design than I thought), this seems very intuitive to me from an object-oriented sense. Perhaps this is only a personal preference, but it turns what would otherwise be a "repository object" into a "dump of DB helper methods."
In such a system, I would expect that the number of random one-time methods will increase significantly over time, as developers make quick decisions to meet the requirements without thinking about the general architecture. Instead of a coherent and well-managed series of objects, you could probably get a bloated and hard-to-reach code base.
David source share