wvnoort wrote:
Frans,
As I understand what you suggest:
I need to create my own keys in the config file (where the username and password are encrypted) and then I need the dataAccessAdapter get the values from the config file, decrypt it, and construct the connectionstring and pass it to the DataAccessAdapter.
Is that correct?
No, you can store the connection strings anywhere you like, as when you pass in a connection string into the constructor, the connection string is not read from the config file, but the one passed in is used.
Now a variation on this theme: The DataAccessAdapter is database specific. I also want to switch dynamically between Oracle and Sql Server without having to use 'if() ... else ..' construction through all code.
Wouter
DataAccessAdapter implements IDataAccessAdapter. So your code can program against the interface and you have to write a small factory which creates either an Oracle DataAccessAdapter or an SqlServer DataAccessAdapter (i.e.: instantiates a dataaccessadapter instance from the oracle database specific project or instantiates a dataaccessadapter instance from the sqlserver database specific project). You have to keep the columns the same between oracle and sqlserver and you have to use compatible types (i.e.: don't use GUID's on sqlserver or bit fields, as these are not supported on oracle).
A dataaccessadapter factory class is a good idea anyway, as you need to obtain the connection string and decrypt it as well.