0

I have created a MVC application where my forms in the views are using a DBML as a model. But how do i validate when im not really using a traditional model file?

1 Answer 1

0

Try the method suggested in this post of using the metadatatype attribute.

Sign up to request clarification or add additional context in comments.

4 Comments

That looks interesting, his problem is exactly as mine. What i dont understand is how its fully implemented. And how it knows about the properties/variables in my dbml file.
The DBML entities are declared as partial. In that solution he supplements the entity declaration with another partial solely for the purpose of adding the metadatatype to instruct MVC to use the secondary type for validations/data annotations. That, at least, is my understanding.
that makes good sense, but i dont understand the metadata stuff.
It is instructing MVC that the specified class contains metadata for the class, which could include validation details, etc. See the remarks in the msdn article I linked, or this article with a similar example: msdn.microsoft.com/en-us/library/ee256141.aspx

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.