Click here to Skip to main content
15,879,613 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have an application and an assembly. App_1 and ass_1.In ass_1 there are forms and typed datasets referenced from app_1 or any other application so that forms and classes in ass_1 can be called from those apps ie. app_1,app_xx etc. the referencing apps have their own database connections so the referenced assembly (ass_1) has to get its connection string from the referencing app (app_1). Ass_2 will be referenced from GAC (shared) so that different apps can reference it. How do I go about this in C#. ie. dynamically changing connection strings of referenced assembly at runtime. NB: The referenced assembly (ass_1) may have more than one referenced instances runinng at the same time and each instance will have its own connection string from the referencing app (app_1).
Posted
Updated 17-Nov-15 4:09am
v3
Comments
OriginalGriff 17-Nov-15 7:02am    
This is not a good question - we cannot work out from that little what you are trying to do.
Remember that we can't see your screen, access your HDD, or read your mind.
And that doesn't make a lot of sense to me as it is.
How do the two communicate? What connection string? Why are these separate apps? Or or they referenced assemblies within a single application?

Use the "Improve question" widget to edit your question and provide better information.
John C Rayan 17-Nov-15 8:06am    
We can help you only if you give us more information as to what type of applications you are talking. I can't see any reason why cant you use a bit information in one app from another app. But need more information.

Either :
1) Read the connection string from a configuration file.
2) Create an interface for your assemblies and pass the connection as a parameter to those assemblies.
 
Share this answer
 
Comments
Abhinav S 17-Nov-15 10:47am    
5!
Mehdi Gholam 17-Nov-15 10:57am    
Cheers
Connections should never be part of code.
Read them from any configuration app.config/xml etc.
 
Share this answer
 
Comments
Mehdi Gholam 17-Nov-15 10:57am    
True! 5'ed
Abhinav S 17-Nov-15 11:18am    
Thank you.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900