如何将标量属性设置为唯一 [英] How Do I Set A Scalar Property To Unique

查看:130
本文介绍了如何将标量属性设置为唯一的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好。



我正在创建一个有一个名为Faculty的表的数据库。 Faculty表有一个名为FacultName的列(它不是EntityKey)。



但是,我想确保尽管FacultyName不是关键属性,但教师姓名不能输入两次。如何在模型第一种方法中使用Visual Studio 2013设计器为edmx设置此行为?

Hi all.

I am creating a database which has a table called Faculty. The Faculty table has a column called FacultName (it is not the EntityKey).

However, I would like to ensure that despite FacultyName not being a key attribute, a faculty name cannot be entered twice. How can I set this behavior using Visual Studio 2013 designer for the edmx in a model first approach?

推荐答案

在此处阅读:

http://code.msdn.microsoft.com/windowsdesktop/CSASPNETUniqueConstraintInE-d357224a [ ^ ]


这篇关于如何将标量属性设置为唯一的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆