A public forum for discussing the design of software, from the user interface to the code architecture. Now closed.
Hello. I'm using the data access application block in Enterprise Library for .NET 1.1. I can connect to and use a hard coded database, but I would like to be able to add database connection strings to the dataconfiguration.config file programatically (similar to the Enterprise Library Configuration Console). My application will allow the user to create a new database on the fly and then connect to it, so I need to be able to add the new connection string to the config file and then open it.
However, I haven't found a way to do it. Any suggestions?
Data Access Application Block
Wednesday, February 08, 2006
There's no ent.lib. built in support to do this (to my knowledge). You'll have to basically open the file, read the xml content, write yours, and write it back to the disk. programmtically.
Thursday, February 09, 2006
There is built in support - sort of.
The Data Access block, like everything else in Enterprise Library, handles its configuration data via the Configuration Block. What you'd need to do is open the data configuration file via the configuration block, make the appropriate changes, and save the file using the config block.
I unfortunately don't have actual code to show you, as I've never done it, but that's the direction I'd take.
I suppose you want to store the settings for the application.
You could use the Configuration Application Block which is meant for that.
Friday, February 10, 2006
This topic is archived. No further replies will be accepted.Other recent topics
Powered by FogBugz