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

Validator for base interface #44

Open
ABIOLI-COM opened this issue Oct 18, 2022 · 1 comment
Open

Validator for base interface #44

ABIOLI-COM opened this issue Oct 18, 2022 · 1 comment

Comments

@ABIOLI-COM
Copy link

ABIOLI-COM commented Oct 18, 2022

Hi Peter.
I'm trying to use this library, but I have a validator for a base interface and two different implementation classes, so that my situation is something like:

public class MyValidator : AbstractValidator<IBaseInterface> {...}

And then I have two 'validatable' classes like in:

public class A : IBaseInterface {...}
public class B : IBaseInterface {...}

I think that the automatic discovery you implemented in this library records only the direct types, so when I have a Blazor form based on an instance of class A, for example, I see that validation doesn't automatically kick in.
I would like to have the possibility to register manually custom behaviors like this case, something like:

builder.Services.RegisterValidator<A, MyValidator>();
builder.Services.RegisterValidator<B, MyValidator>();

...unless I have some other error that I don't see, of course... :-)

Thank you (again :-) )
Andrea

@StevenTCramer
Copy link
Contributor

@ABIOLI-COM

<Morris.Blazor.Validation.Validate ValidationProperties=@(ValidationProperties.Set.FluentValidator()) />

@mrpmorris
It would be much nicer if it were.

<Morris.Blazor.Validation.Validate FluentValidator=typeof(YourInterfaceValidator) />

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

No branches or pull requests

2 participants