Connection string for all the layers

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a solution which contains windows,web,mobile presentations. Now i want to share the connection string in the web.config file.

i want to write a method in a common layer where i can retrieve the connection string for all the presentations layers

How can i do that? Any suggestions or urls are suggested?

Thank you
 
Why would a mobile solution want the same connection string as a web app?
Are they connecting to the same database?

If so, wouldn't you want to have your data layer in one place? And if so,
I'd think you'd want to place that data layer under web services, so that
only the data layer would have the connection string... The rest would
access the web services instead.

Have a default value in the installed config file that points to the web
services server, and allow the user to change it. That way, if you change
your URL, then folks who already have your app installed can change the
value through a U/I, and not by editing the config file.

Good Luck,
--- Nick

Varun said:
I have a solution which contains windows,web,mobile presentations. Now i
want to share the connection string in the web.config file.
i want to write a method in a common layer where i can retrieve the
connection string for all the presentations layers
 
Hi Nick
Thank you for ur reply
I didnt get the clear idea how i can have connection string under datalayer, for both windows and web forms.
Please can you give me a clear idea. And yes i am using the same database fro both the forms.

Thank you
 
Hi Varun,

So you aren't worried about mobile?

As for windows vs. Web, will the windows forms be using a data layer that is
on the web server, or a third location, or will the data layer be deployed
directly to the client machines?

I recommend that you set up a service that provides data access. The
service can use .NET remoting, or SOAP web services, or both, to communicate
with it's clients.

The web interface can use the service, as can the windows clients.

The service can place it's connection string in it's config file, or the
registry.

The web app would need the URL of the data access service, as would the
client components, probably in their own config files.

Does this make sense?

--- Nick

P.S. In the simplest scenario, where the windows client and the web clients
always run on the same server, just put the connection string in the
registry. This is not a common solution, so it's not the most useful
choice.
Varun said:
Hi Nick
Thank you for ur reply
I didnt get the clear idea how i can have connection string under
datalayer, for both windows and web forms.
 
Back
Top