|
-
Aug 1st, 2007, 02:05 PM
#1
Thread Starter
Fanatic Member
[2005] in dll project:I need my dataset to read the connectionstring from web.config
Hi,
I created a dll that serves as my data logic and a bit of business logic
in the dll, I used dataset designer to generate my data access classes...etc
Because it s a dll project, the dataset reads the connection string from the file: Settings.settings
Need: For maintainance reasons, I dont want my dataset to get the connectionstring from the dll file Settings.settings but from the file web.config of the main web application. I need to do that overwriting the designer.cs when the DB changes or when the dataset is regenerated again.
Thanks a lot for your help.
-
Aug 1st, 2007, 02:21 PM
#2
Re: [2005] in dll project:I need my dataset to read the connectionstring from web.config
So, what's the real question?
-
Aug 1st, 2007, 02:33 PM
#3
Thread Starter
Fanatic Member
Re: [2005] in dll project:I need my dataset to read the connectionstring from web.config
the real question is: in the dataset of the dll, I need to set its connectionstring from the web.config of the main web application. this last web application refers to the dll including the dataset
thnx
Thanks a lot for your help.
-
Aug 1st, 2007, 03:06 PM
#4
Re: [2005] in dll project:I need my dataset to read the connectionstring from web.config
In that case you'd have to edit the code file that created the dll. Tell it to look at the web.config instead of itself.
-
Aug 1st, 2007, 09:07 PM
#5
Thread Starter
Fanatic Member
Re: [2005] in dll project:I need my dataset to read the connectionstring from web.config
how do i do that?
notice it s a dll project
thnx
Thanks a lot for your help.
-
Aug 3rd, 2007, 07:16 AM
#6
Re: [2005] in dll project:I need my dataset to read the connectionstring from web.config
It's a DLL project, so why are you using a designer?
If you're still going to continue like this, search for a place in your generated code where the settings file is being referenced. You can then modify it to use System.Configuration.ConfigurationSettings... but if you can't find it, then it's time for you to re-think your DLL.
-
Aug 3rd, 2007, 08:57 AM
#7
Thread Starter
Fanatic Member
Re: [2005] in dll project:I need my dataset to read the connectionstring from web.config
 Originally Posted by mendhak
It's a DLL project, so why are you using a designer?
.
Because I want the designer to generate all the classes I need automatically, I don t want to code all the data classes, objects classes...etc,
do i have any other choice, Mr Mendhak?
 Originally Posted by mendhak
If you're still going to continue like this, search for a place in your generated code where the settings file is being referenced. You can then modify it to use System.Configuration.ConfigurationSettings... but if you can't find it, then it's time for you to re-think your DLL.
If I do it that way, Is not that code gonna be overiden when the dataset is regenerated next time, let s say if I change some thing in my dataadapters or if I add a field in a datatable in my dataset?
Here is the place where setting file is referenced, it s in the designer.cs file of my dataset like this:
private void InitConnection() {
this._connection = new System.Data.SqlClient.SqlConnection();
this._connection.ConnectionString = global::EticketsDAL.Properties.Settings.Default.OrleansEcommConnectionString;
If I change that, won't the changes I make be overriden next time I regenerate the dataset?
Thanks a lot
Last edited by tutus; Aug 3rd, 2007 at 09:00 AM.
Thanks a lot for your help.
-
Aug 3rd, 2007, 10:57 AM
#8
Re: [2005] in dll project:I need my dataset to read the connectionstring from web.con
 Originally Posted by tutus
Because I want the designer to generate all the classes I need automatically, I don t want to code all the data classes, objects classes...etc,
do i have any other choice, Mr Mendhak?
Yes. Coding all the data classes and objects as required. Some may call it convenience, I call it laziness.
If I do it that way, Is not that code gonna be overiden when the dataset is regenerated next time, let s say if I change some thing in my dataadapters or if I add a field in a datatable in my dataset?
Here is the place where setting file is referenced, it s in the designer.cs file of my dataset like this:
private void InitConnection() {
this._connection = new System.Data.SqlClient.SqlConnection();
this._connection.ConnectionString = global::EticketsDAL.Properties.Settings.Default.OrleansEcommConnectionString;
If I change that, won't the changes I make be overriden next time I regenerate the dataset?
Thanks a lot
Suit yourself. http://www.bbits.co.uk/blog/archive/...1/28/6698.aspx
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|