0

I have a C# .NET 4 Windows Service that needs to store its run history (records with date/time, stats, and success/failure). There will usually be 1 entry per day, so over time the run history will grow to a few hundred or low thousands, but I don't expect to grow into tens of thousands. Each entry will have 10-15 fields.

This run history needs to be read and displayed by a WPF application running on the same machine as the Windows Service. This machine has a fresh OS install with .NET Framework 4 and nothing else installed.

Where is the best place and the best format to store the run history so that it can quickly and easily be loaded into the WPF app?

I am considering an XML file, perhaps bound to a Grid (I'm not really a WPF expert). Would 1 XML file be OK for records of this size, and would it be easy to load in WPF? Would you have any better recommendations?

dsolimano
  • 8,870
  • 3
  • 48
  • 63
Zaid Masud
  • 13,225
  • 9
  • 67
  • 88
  • 1
    XML is a fine solution for data of this kind. However, in addition to the XML repository of basic run facts, you may also want to consider using Apache Log4Net, which is a project that allows significantly more detailed process logging. – Ted Spence Aug 27 '12 at 17:44
  • @TedSpence thanks, I am trying to decide between log4net and nlog for more verbose logging and am seeing [opinions preferring nlog](http://stackoverflow.com/questions/710863/log4net-vs-nlog) ... did you have any preferences? – Zaid Masud Aug 27 '12 at 17:49
  • I haven't tried NLog - but I have used Log4Net and found it solid. The only awkward part of it is that Log4Net has a philosophy of "not interfering with your program"; which means if the log configuration is set up badly, you'll get no reports but your program will still run. This is good because your program still runs; but it is bad because when someone breaks the config file you'll get no log. – Ted Spence Aug 27 '12 at 18:08

1 Answers1

1

XML would work, but personally I would pick SQLCE in this case. Easy to use, free and easy to upgrade to SQL Server Express or Standard in the off chance you would ever need to.

http://www.microsoft.com/en-us/download/details.aspx?id=17876

E.J. Brennan
  • 45,870
  • 7
  • 88
  • 116
  • Thanks for this, assuming that I can include SQLCE as a reference in the project with no other dependencies or installations required, and that two different processes can read/write to it concurrently? Also any opinions on SQLLite? – Zaid Masud Aug 27 '12 at 17:58
  • 1
    SQLLite is also very nice - it's encapsulated and has solid performance. However I wouldn't use it if I had to share the database between multiple machines. XML has the advantage that it can be opened by pretty much any program, and XML merging is quite easy. So imagine you run the program on multiple machines - you can pick up and deposit the XML files anywhere. – Ted Spence Aug 27 '12 at 18:07