Azho KG
Azho KG

Reputation: 1171

ASP.NET MVC 2 DataAnnotation based Validation conflict with LINQ2SQL

ASP.NET MVC 2, gives a good functionality of annotation based validation, but to use this functionality I need to reference two files (Microsoft.Web.Mvc.ModelBinders.dll and System.ComponentModel.DataAnnotations.dll) as described here

I use LINQ2SQL, to create my entities. And it uses it's own annotations within Entity classes, which needs another version of System.ComponentModel.DataAnnotations.dll

So currently I'm able to use one of them (either validation or linq2sql) Does anyone encountered same problem? Or does anyone know how to solve this problem?

Upvotes: 2

Views: 755

Answers (1)

LiamB
LiamB

Reputation: 18596

What you need to do is create MetaData classes for the fields that you want to valdiate,

http://www.asp.net/learn/mvc/tutorial-39-cs.aspx (Using Data Annotation Validators with the Entity Framework)

Upvotes: 4

Related Questions