Hi all,

I sent this a few days ago to the CSharpNET list at yahoogroups but nobody
sent back a response.  Since the issue is not trivial, and I'm sure I am not
the only one interested in a solution, maybe some of the folks in this group
will be able to help... (like for Chris Sells, a famous guru and an
ex-colleague of mine as an MSDN Regional Director :))


-----Original Message-----
[del]

I have the following situation: I often build data-driven forms (in Windows
or for the web) and like the design time surface in the VS.NET IDE. Things
like defining a DataAdapter directly on the design surface, then using it to
model columns in datagrids are a real timesaver.

All applicable objects, however, require connection information for the DB
server, and this comes in the form of SqlConnection.  Using the default
behavior of SqlConnection in commercial apps is ridiculous - if I have 20
forms, I will end up having 20 different copies of a connection string,
possibly with a clear-text password embedded, in my source code!

This is why I prefer to have an architecture where I have a factory class
that acts as a connection dispenser. There is only a single place in the
source code that produces SqlConnection instances at runtime.  I then use
these for all my SqlDataReader / SqlDataAdapter needs.

Now the actual question: is there a way to add a SqlConnection object (or
possibly another class, but implementing the proper interface) that is
accessible by the VS IDE designer, I can see it on the design surface, use
it at design time, and yet at runtime I want to be able to "replace" - or
"attach" a connection obtained from another source to this object so that I
don't keep connection strings in my source code (or rather, prevent the IDE
from autogenerating this code)?

Any help will be appreciated.

K. Lilov
Str Library at http://www.utilitycode.com/str
[del]

Reply via email to