The [Required] attribute indicates that a property value must be provided.
The [String Length] attribute is used to specify the maximum length and optionally the minimum length for a property value.
The second Index() method accepts User Profile as a parameter. The Is Valid property returns false if any of the properties contain invalid values.NET Entity Data Model to the project so that you get the User Profile entity class as shown above.In this example, you will validate all of the columns except Id, using various data annotation attributes. NET class (POCO) then you can directly decorate its properties with data annotation attributes.The [Metadata Type] attribute accepts the type of the class that is supplying metadata information to the User Profile class (User Profile Metadata in this case).Now, add a new controller in the Controllers folder and name it Home Controller.
Then add a new SQL Server database named User Db to the App_Data folder and create a table - User Profile.