PC Review


Reply
Thread Tools Rate Thread

Connection Strings

 
 
michaeltorus
Guest
Posts: n/a
 
      16th Jun 2005
Hi

Trying to sort out how to implement the use of connection strings with our new .Net Data Acces Layer(DAL).

2 solutions have been propoesed. Both suggest storing the connecion string in the machine.config file. The DAL uses SQLCleint namespace. At this stage there is only one SQL data store(with multiple data bases), but that might change in the future. Also, we are not using COM+ / Enterprise services, only manual transactions.

The 2 solutions differ, in that the first requires each part of the application to get the connection string, and pass it through every tier/layer (presentation, business, dalcs) to the DAL ...

The second solution makes it possible for the DAL to retrieve a named datasrouce from machine.config, and only DAL Components(DALCS which inherit the DAL) can specify a datasource.

If this makes any sense, can anyone suggest best of the two options, and why they think that? And if anyone has an even better solution to post that up would be great !

Cheers

Mike

---
Posted using Wimdows.net Newsgroups - http://www.wimdows.net/newsgroups/
 
Reply With Quote
 
 
 
 
Miha Markic [MVP C#]
Guest
Posts: n/a
 
      16th Jun 2005
Hi,

"michaeltorus" <michaeltours@-NOSPAM-btinternet.com> wrote in message
news:(E-Mail Removed)...
> Hi
>
> Trying to sort out how to implement the use of connection strings with our
> new .Net Data Acces Layer(DAL).
>
> 2 solutions have been propoesed. Both suggest storing the connecion string
> in the machine.config file. The DAL uses SQLCleint namespace. At this
> stage there is only one SQL data store(with multiple data bases), but that
> might change in the future. Also, we are not using COM+ / Enterprise
> services, only manual transactions.
>
> The 2 solutions differ, in that the first requires each part of the
> application to get the connection string, and pass it through every
> tier/layer (presentation, business, dalcs) to the DAL ...
>
> The second solution makes it possible for the DAL to retrieve a named
> datasrouce from machine.config, and only DAL Components(DALCS which
> inherit the DAL) can specify a datasource.


You proabably mean app.config and not machine.config...

>
> If this makes any sense, can anyone suggest best of the two options, and
> why they think that? And if anyone has an even better solution to post
> that up would be great !


I would go with first solution - so the main application layer has control
on which connection string to use (flexibility - it can control which string
is used).

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/
SLODUG - Slovene Developer Users Group www.codezone-si.info


 
Reply With Quote
 
michaeltorus
Guest
Posts: n/a
 
      17th Jun 2005
Thanks for your reply... however, both options allow the application layers to specify the connection string.

The differences are as follows:

The first option would require the application layer to read it from machine.config. So every part of the application would need to be able to read from machine.confic, and then pass a connection string, which is essentially a database technology, between application layers and down to the DAL.

The second option only requires that an a DALC (which inherits the DAL, and is still part of the data access layer) is able to name it's datasource. The DAL is then able to read the named datasource from machine.config. Only the DAL needs the ability to read from machine.config, and only the DAL is ever dealing with a real connection string.

Hope that explains it better ....



---
Posted using Wimdows.net Newsgroups - http://www.wimdows.net/newsgroups/
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
asp.net 2...where do you put your DB connection strings? Darrel Microsoft ASP .NET 5 13th Apr 2006 05:21 AM
Connection strings James D. Marshall Microsoft Dot NET 0 16th Feb 2006 12:59 AM
SQL Connection strings Jon Microsoft VB .NET 1 12th Dec 2005 07:36 PM
Getting rid of connection strings? =?Utf-8?B?TWF1cnkgTWFya293aXR6?= Microsoft Access 1 25th Nov 2004 03:45 PM
Different connection strings. What to use? Erik Cruz Microsoft ADO .NET 1 25th Mar 2004 05:26 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:44 AM.