0

Imagine a service receives two parameters: ConnectionString and Script.

public class MyExecutor
{
   // execute that script in that connection context
   Execute(String: Script)
   {...}
}

My task is to create that service, capable of receiving different connection string from different DB and DBMS using Spring.Net.

Now I'm pondering about performance. I guess I ill need to create some kind of connection manager as a singleton.

// Probably a singleton
public class MyManager
{
   private MyList List<connections_allready_open>

   Execute(String:ConnectionString, String:Script)
   {
      //check if that connection is already open or create a new and add it to the list
      var myConnection = MyList.findOrCreate();

      // use that connection to execute the script
      with myConnecion
      {
          MyExecutor.Execute(Script);
      }
   }
}

The main problem is I'm total clueless about Spring.Net, not even knows the name spaces to declare. Appreciate any comments, ideas and suggestions about this job.

jean
  • 4,159
  • 4
  • 31
  • 52

1 Answers1

-1

I managed to do it by myself creating a DataBaseHelper to handle my commands and instantiate a singleton for each different connection string sent (they are parameters to my class constructor) and a SpringManager class to handle context creation and put that singletons in a list.

jean
  • 4,159
  • 4
  • 31
  • 52