473,386 Members | 1,715 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

DAL should use web.config connectionstring?

I have a 3 tiered archetecture:

Presentation Layer running ASP.NET through VB.NET with a web.config & 2
connection strings defined in the web.config

Business Logic layer which is nothing more than a set of wrappers for the DAL.

Data Access Layer, which is a set of data tables and data adapters created
through the XSD GUI.

I want the Connection Strings from my web.config to appear in the dropdown
list for the properties of the Data Adapters. How can I do this? Right
now, it only includes connection strings from MySettings, (New Connection),
and (None).

Thanks,
Jul 2 '07 #1
1 1698


My mode for doing this is :

I use the EnterpriseLibrary first off.
using System;
using System.Collections.Generic;
using System.Text;

using Microsoft.Practices.EnterpriseLibrary.Data;
namespace MyCompany.Applications.MyCustomApplication.Data
{
public abstract class DataLayerBase
{

private string _instanceName = string.Empty;
public DataLayerBase()
{

}

public DataLayerBase(string instanceName)
{
this._instanceName = instanceName;

}
protected Microsoft.Practices.EnterpriseLibrary.Data.Databas e
GetDatabase()
{
Database returnDb;
if (this._instanceName.Length 0)
{
returnDb =
DatabaseFactory.CreateDatabase(this._instanceName) ;
}
else
{
returnDb = DatabaseFactory.CreateDatabase();
}
return returnDb;
}

}
}

Then all my DataLayer objects (EmployeeData for example) inherit from that
class.

The .config file is just xml, so you can read it using Xpath statements.
which looks like

\\configuration\connectionStrings\add

XmlNodeList nl = root.SelectNodes ( \\configuration\connectionStrings\add) ;

something ~like that ( I have not tested this, just giving you an idea).


"Eigh" <Ei**@discussions.microsoft.comwrote in message
news:F3**********************************@microsof t.com...
I have a 3 tiered archetecture:

Presentation Layer running ASP.NET through VB.NET with a web.config & 2
connection strings defined in the web.config

Business Logic layer which is nothing more than a set of wrappers for the
DAL.
>
Data Access Layer, which is a set of data tables and data adapters created
through the XSD GUI.

I want the Connection Strings from my web.config to appear in the dropdown
list for the properties of the Data Adapters. How can I do this? Right
now, it only includes connection strings from MySettings, (New
Connection),
and (None).

Thanks,

Jul 3 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: WFB | last post by:
Hi, I have an application with a couple of referenced assemblies. The referenced assemblies and my application all share a few configuration settings with the same name but different values. ...
3
by: Christopher Kimbell | last post by:
I have a class library that contains a number of TableAdapters and I'm using this from a web application. Is there a way of getting the TableAdapters to use the connectionstrings defined in...
5
by: Jason Chan | last post by:
I have a subfolder in a webapp How can the aspx in the subfolder access the web.config in the webapp. I.e. I stored the connectionstring in the \webapp\web.config how the...
3
by: Tim Gallivan | last post by:
Hi all, I think read somewhere (but I can't find it ... note to self: must get new filing system ...) that there is a workaround so that an app.config can have multiple keys with the same name...
2
by: news.microsoft.com | last post by:
Hi After conducting a several searches, I wasn't sure where to post this question. So my apologiesbefore hand for double posting this and possibly posting to the wrong forum(s). Okay, I have...
3
by: Jim Andersen | last post by:
Hi, I would appreciate if someone could explain this behaviour, and maybe offer a better solution. I have been working with the GridView control. And SqlDataSource. It works great if I do:...
2
by: SalamElias | last post by:
Hi, I am confornted with a problem regarding web.config file. I have 4 environements (Dev, Test, staging and production). The IT people need wgenever a new MSI delivered to have the right...
6
by: Irfan | last post by:
hi, After installing the application in the client machine using ClickOnce, i would like that the client be able to change the database path in the Application.Config file. However, clickonce...
12
by: dbuchanan | last post by:
Hello, (Is this the proper newsgroup?) === Background === I am building a solution with two projects. One project is my data access layer which contains my DataSet as an xsd file. The XSD...
2
by: Johnson | last post by:
I'm trying to fix a "sub optimal" situation with respect to connection string management. Your thoughtful responses will be appreciated. I just started with a new client who has a bunch of legacy...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.