How to implement Unique Attribute in property/field #5408
-
In any condition we have to unique for property in database https://www.w3schools.com/sql/sql_unique.asp How to implement in Serenity? I just use [Unique] attribute but can not work Thanks & Regars, |
Beta Was this translation helpful? Give feedback.
Answered by
minhhungit
Jan 29, 2021
Replies: 2 comments 5 replies
-
It has UniqueConstraint attribute, put it on your row class, like this [UniqueConstraint(new[] { "SupplierId", "OemNumber", "StockNumber", "YardLocation" })]
public sealed class InventoryStoreRow : Row, IIdRow, INameRow {
[DisplayName("Id"), Identity]
public Int32? Id {
get { return Fields.Id[this]; }
set { Fields.Id[this] = value; }
}
} |
Beta Was this translation helpful? Give feedback.
5 replies
Answer selected by
harifenny
-
Finally, I copy paste like in UserRepository.cs to implement my problem. Thanks a lot |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It has UniqueConstraint attribute, put it on your row class, like this