Hi everyone!
I am completely new to Temporal and currently planning a .NET backend application.
Since Temporal introduces concepts like Workflows, Activities, and Workers, I want to make sure I structure my project correctly from the start.
Could you share your favorite architectural patterns or project layouts for Temporal in .NET?
-
Do you separate Workflows and Activities into different class libraries?
-
Do you have a service layer or put logic right in the Activity?
-
Any tips for folder structures or naming conventions?
I’d love this thread to be a place where we can all share what works best. Thanks in advance!
For example, can I register an activity in Worker like this?
builder.Services.AddScoped<IBusinessActivities, BusinessActivities>();
and then
builder.Services
.AddHostedTemporalWorker(
…
…
…
.ApplyTemporalActivities<BusinessActivities>();
or avoid this → builder.Services.AddScoped<IBusinessActivities, BusinessActivities>();
and leave worker registers concrete implementation .ApplyTemporalActivities<BusinessActivities>();
Because, as I can see, Temporal docs say AddScopedActivities<T> registers the given type as scoped if not already done. In this case, is this safe →
builder.Services.AddScoped<IBusinessActivities, BusinessActivities>();