Solved

Generic Connection CLASS with connection string for a ComapnyNamespace

Posted on 2004-08-03
4
288 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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Article by: Ivo
C# And Nullable Types Since 2.0 C# has Nullable(T) Generic Structure. The idea behind is to allow value type objects to have null values just like reference types have. This concerns scenarios where not all data sources have values (like a databa…
Introduction Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

806 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