Link to home
Start Free TrialLog in
Avatar of Yann de Champlain
Yann de ChamplainFlag for Canada

asked on

Generic Connection CLASS with connection string for a ComapnyNamespace

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:
 https://www.experts-exchange.com/questions/20776089/Best-practices-for-storing-DB-Connection-Credentials.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.
ASKER CERTIFIED SOLUTION
Avatar of gregoryyoung
gregoryyoung
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Yann de Champlain

ASKER

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.
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 :)
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.