Dotnet core and services
Hey all,
I’m working on a web project and I’m struggling with an aspect, I have my “bad” solution but I’d prefer to go about it in a better way.
Problem: send out emails via smtp on a schedule
Bad solution: I created an endpoint on my API that performs a check on whether it should send an email out or not. Then I just created a power shell and a bash script that just hits the url. It works, email gets sent out.
Why I think this is bad? The whole point of core is cross platform and since I am not sure where I’m developing to yet, I don’t like this solution since “scheduling” to run the script is very platform specific.
Help with a better solution? I think this should be created as either a service or something but I really don’t have much experience on going about this, especially within the dotnet core realm. I think one solution is creating a service that hooks into some kind of scheduler with a job factory and it fires off the emails. The other is just creating a standalone console app that connects to my dB that is always running and sends off emails when conditions are met (the main issue I have with this approach is I was using entity framework and the SQLite dB was auto generated and so I’m not sure how to have the standalone project connect to that local database).
Any help/suggestions would be greatly appreciated (hoping this is the right sub for this post, if it’s not I can repost where is appropriate)
0 comments:
Post a Comment