开发者

String in Unique Key in Entity Framework

开发者 https://www.devze.com 2023-02-26 07:46 出处:网络
Is it possible to put a string in Unique Key ? public int ID{ get; set; } public string TweetID { get; set; }

Is it possible to put a string in Unique Key ?

    public int ID{ get; set; }

    public string TweetID { get; set; }

Because I need ID in primary key (it's ok) and TweetID in unique key (for no duplication in database)

EDI开发者_如何学运维T : I use Entity Framework 4 and MVC3


It is possible to define unique key on string column but you must do it in the database (as unique index) because none of current EF versions support unique keys.

0

精彩评论

暂无评论...
验证码 换一张
取 消