HangfireIO / HangfireIO/Hangfire

[Question] Acquiring dependencies when using JobFilterAttribute with .NET CORE 2.0

Open
#992 12 comments 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
10.1k
Forks
1.8k
Avg merge
1h 19m
Merged PRs (30d)
1

Description

How is it that I can extend JobFilterAttribute from my own class and be able to access dependencies from within the class?

What I need to do is access configuration settings to acquire web service information to make a web service all form during state changes.

Is this possible to be done with .NET CORE 2.0

```csharp
public class StateFilter : JobFilterAttribute, IApplyStateFilter
{
public void OnStateApplied(ApplyStateContext context, IWriteOnlyTransaction transaction)
{
// NOTE: Access dependencies to make web service call
}

public void OnStateUnapplied(ApplyStateContext context, IWriteOnlyTransaction transaction)
{
// Not implemented intentionaly.
}
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.