Solved

Generic Connection CLASS with connection string for a ComapnyNamespace

Posted on 2004-08-03
4
292 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Technology Partners: 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

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…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…

691 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