Click here to Skip to main content
15,909,747 members
Home / Discussions / C#
   

C#

 
AnswerRe: Effective way of writing logs in web service in C#.net Pin
Elegantly Wasted25-Mar-15 0:51
Elegantly Wasted25-Mar-15 0:51 
AnswerRe: Effective way of writing logs in web service in C#.net Pin
jschell25-Mar-15 11:28
jschell25-Mar-15 11:28 
QuestionCould not cal the repaint on invalidate Pin
Sarita S24-Mar-15 22:54
Sarita S24-Mar-15 22:54 
AnswerRe: Could not cal the repaint on invalidate Pin
OriginalGriff24-Mar-15 23:06
mveOriginalGriff24-Mar-15 23:06 
AnswerRe: Could not cal the repaint on invalidate Pin
OriginalGriff25-Mar-15 2:19
mveOriginalGriff25-Mar-15 2:19 
QuestionScheduler without using timer class in c# Pin
Member 1138787724-Mar-15 19:48
Member 1138787724-Mar-15 19:48 
AnswerRe: Scheduler without using timer class in c# Pin
Pete O'Hanlon24-Mar-15 20:13
mvePete O'Hanlon24-Mar-15 20:13 
QuestionSingleton vs Whatever Else Quandary Pin
Z.C.M.24-Mar-15 16:58
professionalZ.C.M.24-Mar-15 16:58 
I'm stuck in this quandary on whether or not to redesign the underlying classes for an application that is almost ready to go live (currently in user testing). This is by-the-way where I spend a great deal of my time, in a quandary that is. I've already searched for alternatives, Google, CP, Stack Overflow, etc., with minimal hits where actual discussion had occurred.

But first, some important background information. Where I work virtually all of our Windows applications are for internal use. To help with this we wrote a "menu" application that is used to load all of the other application, which in turn are compiled as dlls.

This has worked fairly well, except the dlls are never unloaded from memory when the user closes the secondary application. These dlls are loaded in a fairly straightforward manner.
C#
Assembly myDLL = Assembly.LoadFrom(baseURL + dbDllName);

With an eventual myForm.Show() to display the secondary application's starting form.

I have several forms in my application and I've used a singleton design, http://csharpindepth.com/Articles/General/Singleton.aspx#lazy[^], for the main class that handles database calls, etc. This is so I don't have to pass an instance of the class around to multiple forms.

The downside to using the singleton with an application loaded by our menu application is there is no limitation on how many instances of my application the user can load. This of course can lead to strange behavior to say the least. For example, performing a search in the first application instance updates the grids in all instances.

Now, finally to my question. What are my options other than the two already mentioned, leave it as is and tell the user to not load more than one instance (seems highly unprofessional), remove the singleton and pass an instance of the first instance of the class to the other four forms (not my favorite thing to do). I'm not up on all the latest design patterns so any pointers would be helpful.
AnswerRe: Singleton vs Whatever Else Quandary Pin
Mycroft Holmes24-Mar-15 17:09
professionalMycroft Holmes24-Mar-15 17:09 
AnswerRe: Singleton vs Whatever Else Quandary Pin
Pete O'Hanlon24-Mar-15 19:32
mvePete O'Hanlon24-Mar-15 19:32 
GeneralRe: Singleton vs Whatever Else Quandary Pin
Z.C.M.25-Mar-15 4:00
professionalZ.C.M.25-Mar-15 4:00 
AnswerRe: Singleton vs Whatever Else Quandary Pin
jschell25-Mar-15 11:34
jschell25-Mar-15 11:34 
QuestionWhat is wrong with the structure of this code? Pin
Member 1147801824-Mar-15 0:25
Member 1147801824-Mar-15 0:25 
AnswerRe: What is wrong with the structure of this code? Pin
Ron Nicholson24-Mar-15 3:20
professionalRon Nicholson24-Mar-15 3:20 
GeneralRe: What is wrong with the structure of this code? Pin
Dave Kreskowiak24-Mar-15 3:48
mveDave Kreskowiak24-Mar-15 3:48 
GeneralRe: What is wrong with the structure of this code? Pin
Member 1147801824-Mar-15 11:06
Member 1147801824-Mar-15 11:06 
GeneralRe: What is wrong with the structure of this code? Pin
Ron Nicholson24-Mar-15 11:43
professionalRon Nicholson24-Mar-15 11:43 
AnswerRe: What is wrong with the structure of this code? Pin
Gerry Schmitz24-Mar-15 12:14
mveGerry Schmitz24-Mar-15 12:14 
Questionc# Pin
Member 1133602722-Mar-15 8:40
Member 1133602722-Mar-15 8:40 
AnswerRe: c# Pin
Afzaal Ahmad Zeeshan22-Mar-15 8:53
professionalAfzaal Ahmad Zeeshan22-Mar-15 8:53 
Questionusing usage (IDisposable) Pin
TMattC22-Mar-15 6:15
TMattC22-Mar-15 6:15 
AnswerRe: using usage (IDisposable) Pin
phil.o22-Mar-15 6:38
professionalphil.o22-Mar-15 6:38 
AnswerRe: using usage (IDisposable) Pin
OriginalGriff22-Mar-15 6:41
mveOriginalGriff22-Mar-15 6:41 
AnswerRe: using usage (IDisposable) Pin
manchanx22-Mar-15 6:54
professionalmanchanx22-Mar-15 6:54 
AnswerRe: using usage (IDisposable) Pin
jschell22-Mar-15 9:40
jschell22-Mar-15 9:40 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.