Versions des environnements
>I'm getting my feet wet with ASP.NET MVC. I'm using MVC4, VS2012, and MVC Scaffolding. I pulled in an existing database using the provided wizard. The generated model does not include annotations like [MaxLength] or [Required]. Did I miss something or is that not a feature of the wizard? Seems like a pretty big missing feature if you ask me. Without it, I have to enter all the annotations manually if I want MVC to do the validations.
You will need to add a partial class and a metadata class :http://msdn.microsoft.com/en-us/library/cc488527(v=vs.100).aspx
Seems like a lot of hassle but if it was not done this way then you would lose any custom validation attributes when the model rebuilds...
Précédent
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement