【问题标题】:How do I make custom Validators in C# Code-First in EF 5如何在 EF 5 的 C# Code-First 中制作自定义验证器
【发布时间】:2013-02-18 23:27:00
【问题描述】:

我试过这个: How to create Custom Data Annotation Validators 但是 Visual Studio 说命名空间: 使用 System.ComponentModel.DataAnnotations.ValidationAttribute; 不存在。 我用的是 EF 5 ..... 我该怎么办?

【问题讨论】:

  • 将命名空间添加到您的项目中。

标签: c# entity-framework ef-code-first


【解决方案1】:

添加对 System.Componentmodel.DataAnnotations 命名空间的引用。

【讨论】:

  • 右键单击项目中的引用文件夹,然后单击添加引用。然后选择框架并选中命名空间左侧的框以将命名空间添加到您的项目中。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-12-13
  • 1970-01-01
  • 2019-05-03
  • 1970-01-01
  • 2014-08-22
相关资源
最近更新 更多