Skip to content

Need guidance for resource hooks #615

Description

@crgolden

Description

I have been trying to get Resource Hooks working in v4.0.0-alpha3. I have followed the steps in the docs, but the hook is never hit.

The only way I have actually gotten it to work is to add an explicit call to AddScoped<IResourceHookContainer<WeatherForecast>, WeatherForecastDefinition>(), then inject the IResourceHookContainer<WeatherForecast> directly into the service. But that seems wrong - looking at the source it should be registered automatically using open generics.

I also run into problems trying to call BeforeCreate because I would then have to magically have a IAffectedResources object somehow. Which seems only to be available internally through some TypeHelper extension methods and internal derived classes.

Getting this to work is a blocker for me using this library in production code because I have to be able to authenticate and authorize at the request level.

Anyway, I have posted a simple repository that reproduces the behavior: https://github.com/crgolden/JsonApiDotNetCoreIssue. Please take a look and let me know what I'm doing wrong.

Thanks!
...

Environment

  • JsonApiDotNetCore Version: 4.0.0-alpha3
  • Other Relevant Package Versions: not sure

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions