Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Generic Connection CLASS with connection string for a ComapnyNamespace

Posted on 2004-08-03
4
Medium Priority
?
295 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
Question by:Yann de Champlain
[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 2000 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
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
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

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

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…
In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …

610 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