Tagged with dotnetcore
[UPDATE] After reviewing some of the code and talking with commenters, I agree that using HostServices for console apps is a bad idea. I've refactored this to use the host but not the HostService. I believe that the entire host is still useful for configuration, logging, and DI. See below for the latest changes:
I was at a customer site last week and a lot of their integration code is a set of console apps that are run on timers to import and export data. This isn't an uncommon use-case.
I've got a couple of these lying around myself. I realized that I didn't know of a good exemplar of doing simple console apps using .NET Core in a way that is closer to ASP.NET Core (e.g. dependency injection, lifetime management, cancellation, etc.). So I decided to re-write an old console app I have.
If you're using .NET Core 3 and Entity Framework Core 3 together, you're probably using the EF Tools too. I've been running into an odd issue with it and wanted to share what is going on.
I know I don't look like it, but I actually like to follow the suggestions. So when I get the following suggestion form the command-line, I tried to update my version: