Beispiel #1
0
 public Task <PartialSleepViewModel> PartialSleepAsync(PartialSleepInputModel sleepInput)
 {
     return(Task <PartialSleepViewModel> .Factory.StartNew(() =>
     {
         Thread.Sleep(1000);
         return new PartialSleepViewModel
         {
             Message = "Slept for a while and returned partial model on Thread {0}".ToFormat(Thread.CurrentThread.ManagedThreadId)
         };
     }, TaskCreationOptions.AttachedToParent));
 }
Beispiel #2
0
 public Task<PartialSleepViewModel> PartialSleepAsync(PartialSleepInputModel sleepInput)
 {
     return Task<PartialSleepViewModel>.Factory.StartNew(() =>
     {
         Thread.Sleep(1000);
         return new PartialSleepViewModel
         {
             Message = "Slept for a while and returned partial model on Thread {0}".ToFormat(Thread.CurrentThread.ManagedThreadId)
         };
     }, TaskCreationOptions.AttachedToParent);
 }