Hello everybody, when I study "Tutorials"->"Chapter 3. MVC Music Store"->"Part 6: Using Data Annotations for Model Validation".
In tutorial, it add "[Bind(Exclude = "AlbumId")]" annotation in the Album.cs file. But I comment this line or not, I always can correctly "Create" new Album.
The "[Bind(Exclude = "AlbumId")]" mean: when you create new album, the primary key is null, so we don't want to model binding include "AlbumId"(PK).(But in my test, I got the same result.)
jwchen.dev
Member
2 Points
8 Posts
[Bind(Exclude..)] without [Bind(Exclude..)] are the SAME?
Feb 24, 2012 05:32 AM|LINK
Hello everybody, when I study "Tutorials"->"Chapter 3. MVC Music Store"->"Part 6: Using Data Annotations for Model Validation".
In tutorial, it add "[Bind(Exclude = "AlbumId")]" annotation in the Album.cs file. But I comment this line or not, I always can correctly "Create" new Album.
The "[Bind(Exclude = "AlbumId")]" mean: when you create new album, the primary key is null, so we don't want to model binding include "AlbumId"(PK).(But in my test, I got the same result.)
ignatandrei
All-Star
135142 Points
21676 Posts
Moderator
MVP
Re: [Bind(Exclude..)] without [Bind(Exclude..)] are the SAME?
Feb 24, 2012 07:14 AM|LINK
A hacker could trick the create page and putting an AlbumId field. Exclude make impossible.