I would like to know if this is possible to create a custom validation for my User Entity.
I Want to verify if the username is unique.
If the user Already exist, I don’t want to save it and show a warning.
I Read about Data Annotation inherits but I’m not sure of what I’m doing.
Please help.
Thanks.
Entity-Framework 4
Asp.net MVC 2
Yes it is possible, you can create your own Custom Attribute class and validate the entity. Something similar to this code,
Also more on CustomeAttribute