Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify Dependency Injection of Projections using IProjectionOf<TReadModel> #124

Merged
merged 10 commits into from
Jan 28, 2022

Conversation

woksin
Copy link
Contributor

@woksin woksin commented Jan 26, 2022

Summary

Adds the possibility to take upon a specific projection read model as a dependency and use that to get the projection states for that read model type.

Added

  • IProjectionOf<TReadModel> that acts as a minimal IProjectionStore for a particular projection type.
  • IProjectionStore.Of<TReadModel>(...) method with overloads for sending in ProjectionId and ScopeId to create instances of IProjectionOf<TReadModel>
  • IProjectionOf<TReadModel is registered in the tenant scoped service providers for all types with the [Projection] attribute, or projections created in the .WithProjections(...) builder. So they can be injected in controllers etc.

@woksin woksin added the minor label Jan 26, 2022
@woksin
Copy link
Contributor Author

woksin commented Jan 26, 2022

To test see the AspNET Sample, it now uses the IProjectionOf<> in the customers controller

Copy link
Contributor

@jakhog jakhog left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, some small things just to fix. And some things we could talk about.

@jakhog jakhog changed the title Projections di Simplify Dependency Injection of Projections using IProjectionOf<TReadModel> Jan 28, 2022
@jakhog jakhog merged commit aacb2d5 into master Jan 28, 2022
@jakhog jakhog deleted the projections-di branch January 28, 2022 09:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants