B.Balamanigandan
B.Balamanigandan

Reputation: 4875

How to Access Database via DLL without a Connection String in C# Console Application

I'm having a Library Application in C#. It contains all EDMX files and Database accessing methods. I created one Console application, in that I refereed that Library DLL to access the methods. But the console application expects the Connection String in local App.Config file. I need a Security, how to access the DLL without specifying the Connection String in the Console Application ?

Is there is any other way is there to achieve the requirement. Kindly assist me.

Upvotes: 0

Views: 396

Answers (1)

Marjan Slavkovski
Marjan Slavkovski

Reputation: 633

You must provide the connection string in order to access the database. If you can't use integrated security then I suggest you to keep keep the connection string encrypted in the app.config file, in the <appSettings></appSettings> section and decrypt it in the console app before sending it to the business layer.

Consult this answer for how to encrypt/decrypt strings: Simple two way encryption for C#

Upvotes: 1

Related Questions