I have a Instance Class that implements an interface and has all methods except for interface methods as static. All the class variables are static too. Two of the static variables are actually instance variables and marked as read only. These read only instance variables are initialized inline.
Here is an example
public class Test : ITestInterface
{
public static readonly DbConnection Connection = new DbConnection();
public void static TestMethod1(){
}
public List<string> static TestMethod2(){
}
}
I have a lot of methods in my Framework layer that uses the static connection variable.
Is this a valid design? I want to use the same object for all my API calls. The idea is to avoid creating mutiple connection objects. At any given day with the load of calls from the client, there is a possibility that 10,000 connection objects can be created. I'm trying to avoid that.