C#C
C#9mo ago
AlisterKB

Hangfire implementation in Repository pattern

Hi, sorry for newbie question.
I am trying to add hangfire to my project. I believe I am using DDD to the best of my ability
trying to incorporate hangfire and follow DDD architecture i've hit a snag.

here is some code snippet from my hangfire implementation in each layer:
https://paste.mod.gg/ynibbxjvpvfc/0

and below is my project structure:
─App.Presentation
─Controllers
─Properties
─App.Application
─Services
─App.Domain
─Aggregates (or I believe more commonly people call them entities)
─App.Infrastructure
─Persistence
─Repositories

I've only installed hangfire related packages in infrustructure layer (Hangfire.AspNetCore & Hangfire.PostgreSql)
due to doing so I only have access to the hangfire methods in infrustructure. now when I wanna use/implement in application layer
RecurringJob.AddOrUpdate(string, Expression<Action>,CRONEXPRESSION)
I pass my JobService a string and I cannot utilize the hangfire method Corn.daily() or other methods provided by hangfire itself.
I really could use your help to know whether I should install hangfire.AspNetCore in application ? and remove it from infrastructure and leave the Hangfire.PostgreSql in infrustructure or what.
really appreciate your kind assistance on this. please let me know if I should provide you with more details.
I would also be very thankful if you could direct me to a code example of hangfire implementation in DDD and Repository pattern.
cheers
A tool for sharing your source code with the world!
Was this page helpful?