0

I have a Visual Studio Lightswitch apllication where I need to perform an operation periodically (Query the database for entries based on the current time, send an email for each row returned, if any, then mark the item in the database)

I can do everything manually on a screen, how do I automate it?

Mike B
  • 2,592
  • 3
  • 33
  • 46

1 Answers1

2

You could use a Timer class, that's set to do "something" every x period of time, but the disadvantage of this is that it will only work while the LS application is actually running.

I've done something very similar, but I created a Windows Service application, that lives completely outside of any LS applivation.

These links might give you something to start off with.

Creating a Windows Service in Visual Studio 2010: http://myhosting.com/blog/2010/09/creating-windows-service-visual-studio-2010/

Create Windows Service in Visual Studio [C#]: http://www.csharp-examples.net/create-windows-service/

How to implement a 'Start' 'Stop' timer in LightSwitch: http://social.msdn.microsoft.com/Forums/da/lightswitch/thread/f14c4420-d43b-4806-bf5d-502b68f1dd89

How to: Create a Timer: http://msdn.microsoft.com/en-us/library/cc189084(v=vs.95).aspx

Yann Duran
  • 3,842
  • 1
  • 24
  • 24
  • Looking at the docs some more it seems that this would be "Completely out of scope" for lightswitch since it would need to run server side and there is no guarantee a thread will be alive at any given moment. – Mike B Jun 18 '12 at 23:56