File tree Expand file tree Collapse file tree 2 files changed +10
-4
lines changed
src/templates/MyProjectWindowsServiceWithDatabase/MyProjectWindowsServiceWithDatabase.Service Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Original file line number Diff line number Diff line change 1717 // One-time launch of user code without the scheduler
1818
1919 using var scope = DIContainer . Current . BeginLifetimeScope ( ) ;
20- scope . Resolver . Resolve < Worker > ( ) . Run ( ) ;
20+
21+ scope . Resolver . Resolve < Worker > ( )
22+ . Run ( )
23+ . ConfigureAwait ( false )
24+ . GetAwaiter ( )
25+ . GetResult ( ) ;
2126}
Original file line number Diff line number Diff line change 1- using MyProjectWindowsServiceWithDatabase . MyEntities ;
1+ using System . Threading . Tasks ;
2+ using MyProjectWindowsServiceWithDatabase . MyEntities ;
23
34namespace MyProjectWindowsServiceWithDatabase . Service ;
45
@@ -8,9 +9,9 @@ internal class Worker
89
910 public Worker ( IMyEntityServiceService service ) => _service = service ;
1011
11- public void Run ( )
12+ public async Task Run ( )
1213 {
13- var items = _service . GetAllAsync ( ) . Result ;
14+ var items = await _service . GetAllAsync ( ) ;
1415
1516 // TODO
1617 }
You can’t perform that action at this time.
0 commit comments