Hi All,
I am new to C# and I am facing a problem with respect to design and deployment of C# program.
My application needs the following:
a) A console program will do some data processing and will store the results in a static variable in Singleton class.
[Imagine the logic like this - This program takes the list of absent employees and find their emailids from a database and store the emailids in a static variable in Singleton class.
Once this is done, the console program starts a timer program. The timer program will take the emailid from the static variable and sends email to those employees once in every one hour - "Are you coming to office or not?"]
b) A GUI program will have one button and on clicking the button, it will access the same static variable in Singleton class.
[
Imagine the logic like this - This GUI allows an administrator to enter an email id in a textbox. Then, the administrator will click the "Add" button. Then, this emailid will be added to the existing list of emailids in the static variable in same Singleton Class.
So, my timer program in (a) will consider this newly added emailid too, when it sends email in the next hour.
]
I am facing the following problem when I try to develop the same. I am not able to access the same static memory variable from GUI program.
In java (if it is a web-based application), we deploy the application in a server and the static variable will be held in memory by the server. So, whichever client request for the variable, server will ensure that it gives the same variable to all. But, I dont know how to do it in C#.
I am using Visucal C# Express Edtion (as of now) for development. I develop it as a project in this IDE under a solution. I am also unable to bring these two programs into a single project. It is because, both of my programs need a Main() method.
Can someone help me out? How to bring these two programs together to access same variable? Thanks.......
Kindly let me know if anymore details are required.
Regards,
Desigan
Note: I request you not to validate the logic of my example. It is not my requirement, but mimics the problem that I am facing.