Solved

Generic Connection CLASS with connection string for a ComapnyNamespace

Posted on 2004-08-03
4
290 Views
Last Modified: 2010-08-05
Hello,
I am working on a very nice namespace for a Company.  I just finished the Exception Class Library and I am now starting on the Data Class Library.

What I was currently looking to do is to create a class that would create and return a connection object for a specific database.

I was going to create an enum of applications that I would make the connection.  This is for an intranet only.  At this time, a DB is connected using a generic user password. In the futur there will be a need to use windows authentication.

I've read an excellent question at:
 http://www.experts-exchange.com/Programming/Programming_Languages/Dot_Net/Q_20776089.html
I got some tips from there.  And some code yet again from _TAD_    ;-)

I want somehting around this but my question is about the assemblies of this namespace.  What would be the better solution to include the connections in the CLASS library?  If I realease a DLL to reference I do not really want to ask user to add a config file. I would better want to have everything in the same assembly file.

The goal is to standardize the connectino in that case, using the namespace Company.Services.Data

THank.
0
Comment
  • 2
  • 2
4 Comments
 
LVL 37

Accepted Solution

by:
gregoryyoung earned 500 total points
ID: 11708239
why not just use the configuration management block from Microsoft to store the various connection strings (it will even encrypt it for you!)
http://msdn.microsoft.com/library/en-us/dnbda/html/cmab.asp

Generally speaking it is better to store such things as a configuration point because you don't want to have to release new dlls to make a change :)
0
 

Author Comment

by:Yann de Champlain, PMP
ID: 11708398
The main problem I was seeing was the fact that I was required to have a external file to refer to.

Your solution is good.  I am planning to add all the MS applciation blocks in my namespace but this one was for a later time.  I think I will need to add it before the Data ;-)

I will read a little more on it and look at wich type of repository I will build.

Thank.
0
 
LVL 37

Expert Comment

by:gregoryyoung
ID: 11708409
you dont have to refer to a file ... you can also use registry etc... but if you are already using this file ... hey why not :)
0
 

Author Comment

by:Yann de Champlain, PMP
ID: 11708473
Ya.  I need to use a Global repository for the company and I don't want to use a database server.
So there is good chance that it end up with an xml file on the NAS. Encrypted I guess.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Extention Methods in C# 3.0 by Ivo Stoykov C# 3.0 offers extension methods. They allow extending existing classes without changing the class's source code or relying on inheritance. These are static methods invoked as instance method. This…
We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question