Hi all, please forgive me for what might be a FAQ but I can't find how
to solve my problem.
I am involved in a relatively big project where we used visual studio
to design our forms, including SqlConnection(s). Any form has its own
SqlConnection, and all connections read the same connection string
from app.config. We initially thought that we could use windows
authentication but some customers need to use sql server
authentication. Now that we already have our project set up this way,
how can we avoid to put a password in plain text in app.config to
connect to the db? We even tried to implement a custom sql connection
using TypeDelegator and an implicit type converter to SqlConnection
(which is sealed), and substituting SqlConnection with our type into
InitializeComponents (so that the connection string is assigned into
InitializeComponents, and then updated by our class), and this works,
but screws up the design window because SqlDataAdapter expects a
"real" SqlConnection.
The questions, at this point, are two:
1. how can we avoid putting that password into app.config
2. (independently) how does one use typedelegator? Can inheritors be
used only with reflection or is there a way to cast a typedelegator to
a specific type at compile time?
Thanks
Vincenzo Ciancia