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

Initialized service provider in validation context. #1869

Merged
merged 2 commits into from
Oct 10, 2024

Conversation

MichalTichy
Copy link
Contributor

This resolves issue reported in #1868.

This change allows users to use complex validation attributes that need access to various services via service provider.

@MichalTichy
Copy link
Contributor Author

I've added simple test.

@tomasherceg tomasherceg force-pushed the Feature/ValidationContextHasServiceProvider branch from 359725f to 74dc13f Compare October 10, 2024 12:01
Copy link
Member

@exyi exyi left a comment

Choose a reason for hiding this comment

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

Ok, thanks for the patch.

Note that the service provider will only work with Singleton services, to allow Scoped and Transient services to work correctly, we'd have to use context.Services instead of config.Services. However, that isn't possible without changing the IViewModelValidator interface, I'd consider doing it later if we want that.

I'll release this one as a 4.3 patch, so you should be able to use the patch soon

@exyi exyi merged commit d2816a9 into main Oct 10, 2024
13 of 17 checks passed
@exyi exyi deleted the Feature/ValidationContextHasServiceProvider branch October 10, 2024 23:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants