Question

I know there are many questions on SO explaining many such comparison but I am in stuck into something else.

I have a class DataAccess(configured to remote proxy) that executes DAL methods, for doing so it holds connectionstring. So far is good.

Now we have decided to combine data from two databases on given condition, so basically it should be like:-

  1. DataAcess brings data from 1st server.
  2. DataAcess brings data from 2nd server.
  3. Result is combined and displayed.

ConnectionString is being set in constructor of DataAccess, and DataAccess is configured to SingleCall, now even if I change my connection string to point SERVER 2 it is rested to SERVER 1 since it is configured to SingleCall.

This happens because Constructor is executed everytime I try to access any method(insert,Update,Delete,Select...) of DataAccess.

I know I can fix this by using Singleton, but have read in many places people advocating SingleCall.

Can you please share your thoughts of problem that can occur if I make it Singleton, any other way or design pattern that can help me here will also be of great help.

Was it helpful?

Solution

Client-activated objects are created on the server when you create an instance using the new keyword. Hence I believe CAO suits best in the current situation.

If you can suggest any better way of doing so will be great.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top