if you wanted to cut out writing the 'boilerplate' yourself, look at something like cinchoo http://cinchoo.com/category/application-host/?orderby=ID&order=ASC[^] - my only bugbear with it is its not open source - there are other 'service frameworks' out there iirc - while writing a service from scratch once is 'useful', the real work is the service 'tasks', so using a pre-built framework allows you to focus on that
In this way, I could have the process on server "CAT" run Services "Scratch" and "Purr", while the process on server "DOG" could run Services "Wag" and "Bark" and moving Services from one server to another was simple. All servers had exactly the same code deployed.
Be careful with that file because if you make it ill formed the application will not load and figuring out that problem is difficult.
I guess the windows app could also start and stop the service as well
A windows service is a windows service, so I am not exactly sure what you mean.
It is possible to structure the build such that one can have a command line executable and a windows service but you probably don't want to try that for your first service.
You might want to also looking into a logging API. Helps in figuring out window service errors.
Well it dawned on me that I already have a configuration file in the web application that I can adsorb for the database connector string and website name. So I can put the service in the web application. Took me awhile to figure that out.
Perhaps the web application can start the web service, and the service will wait for the date and time to start doing its thing via timer.
So on to my first Windows Service. It's new to me and very frustrating. I just got the base code to work, the framework, so now it
Creates an Event Log
Writes to the Event Log
Connects to the service controller
Writes the event log registry entry, and message id file to connect to.
WOW, that was a mind bender. There's help out there, but it's so generic.
Now I know why many said write a console app.
Well now I can go on to writing the job code, and then figure out how to write an id system dll for the event log id's and messages, and register that file.
So I'm going to try reading my config file in the web app first, and see if I can read it, if so I'm on my way to more frustration.
One thing to be aware of. You're doing a case sensitive comparison of a string there. What happens if the case doesn't match what you're testing for (hint, you won't trigger any of your enable conditions)?
i have a problem for making rfid program with socket in c#.
i try this code :
socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.IP);
IPAddress ip = Dns.GetHostAddresses(ipLoc);
IPEndPoint ep = new IPEndPoint(ip,23);
We are now in the planning stage of the next web based project using C#, MVC 5 and Entity framework 6. We are discussing about framing the project using the Repository pattern. We already have the full database ready. So, it is going to be Database first.
Now, my question : Is it feasible / worth using Repository pattern with database first approach? I got this doubt because, many sources and examples found in internet are Code first approach. If it is possible can you please provide me any advice or online/article sources to refer. Thanks.
I welcome any ideas or suggestions on Repository pattern.
As Pete O'Hanlon said, you can. We use the Repository pattern + Unit of Work on the project I'm on right now. While we do use Code First, there is no reason it can't apply to Database First as well. Someone can correct me if I'm wrong, but I don't think the purpose of the Repository pattern was designed specifically for Code First. One advantage of using Repo is testing, another is dependency injection. It's simple to test using a Repository, from what I can tell here.
How do I compare two tables and get the difference?
Dim dtBenefitsCurrent As New DataTable
dtBenefitsCurrent = objDB.GetPlanBenefits(groupID, planID, SequenceNumber)
Dim dtBenefitsPreviousYear As New DataTable
dtBenefitsPreviousYear = objDB.GetPlanBenefits(PreviousgroupID, PreviousplanID, PreviousSequenceNumber)
Dim dyDifference ????
I just notices most of the blogs I used to follow are no more updated by they creator.
What are the good .NET / C# / Application Lifecycle blogs with RSS feed of this moment. I prefer to follow people than organizations. I like blogger that write one article, news or tutorial by weak or month.
Whilst prototyping a console app the other day, it stuck me that the dynamically linked library seemed somewhat redundant in .NET and that was nothing I could do with one that could not be achieved by creating an executable. I can add a reference and reuse publically declared types whilst with both. But an executable has some obvious benefits, yet I've always created DLLs because I've been told 'it's best practice' or just followed other's examples.
Can anyone think of a technical reason why you'd choose to build a library over an executable? Is a DLL an artefact simply for some legacy backwards compatibility that I'm unaware of?