We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Form Validation with a data source

I we are using a bound data object which was created by entity framework, same an Employee class. How do we use it with the class created to hold the form validation rules which are bound to the controls? 

This forum post helped a lot, but the form controls are bound to the Employee class in the razor page and not the Employee class of my data access lay (EF Core) which is also called Employee.

I realize I can map between the two, but that basically makes the ease of using binding harder. Thanks for the help.

5 Replies

SP Sureshkumar P Syncfusion Team January 3, 2020 10:44 AM UTC

Hi Scott, 
Greetings from Syncfusion support. 
We have validated your requirement. we need to load the model class (entity class ex: Employee class) to load the data to the component to validate by using data annotation logic.  
Sureshkumar P 

SP Scott Peal January 4, 2020 01:49 PM UTC

So what does that mean? Does that mean we need to map from/to the Entity Framework generated classes? If yes, that is a horible approach.

Is there any way to just extend the EF generated classes?

SP Sureshkumar P Syncfusion Team January 8, 2020 11:54 AM UTC

Hi Scott, 
We will check the possibilities to add the form validator as our own library at our end. But our component will be working fine with the requested requirement Fluent validation. Please refer to the below sample if it is meet your requirement then you can use it in your application.  
Sureshkumar P 

SP Scott Peal January 16, 2020 02:33 PM UTC

Hi Sureshkumar,

That Accelist.FluentValidation.Blazor package did the trick!  I can still use my Entity Framework generated classes with validatation now. Adding this to the Syncfusion Blazor framework would be a value add to your customers.

Here is the URL to the project for others looking for a solution to this in the short term:

SP Sureshkumar P Syncfusion Team January 21, 2020 10:28 AM UTC

Hi Scott, 
Thanks for your suggestion. 
We have considered to provide “Provide support for form validation plugin in Blazor platform” at our end and this support will be included in any one of our upcoming releases. We will implement the feature based on the customer request count and priority.  
You can track the status of the requested requirement from the below feedback link. 
Sureshkumar P 

Live Chat Icon For mobile
Up arrow icon