Regular expression for validating url

28 Sep

If you don't specify any Error Message, a default error message is displayed.The [Email Address] attribute validates a property for a valid email address.However, in this case our model class is an Entity Framework class.Since the data model class is automatically created for you by the Visual Studio designer it is not recommended to modify the same class file.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).

If an error message is not specified, a default error message is displayed.

Then add a new SQL Server database named User Db to the App_Data folder and create a table - User Profile.

The User Profile table has columns as shown in the following figure: The User Profile table As you can see from the above model class, the User Profile table consists of eight columns, viz.

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.