سؤال

How does one create a unique constraint with ServiceStack.OrmLite (using attributes, hopefully)? The documentation shows how to create a unique constraint only on a single column:

ServiceStack.OrmLite Docs

If it helps, I am using ServiceStack.OrmLite.SqlServer.

هل كانت مفيدة؟

المحلول

Service Stack appears to have a CompositeIndex attribute which takes multiple field names. Here's a look at the constructors...

CompositeIndexAttribute(params string[] fieldNames);
CompositeIndexAttribute(bool unique, params string[] fieldNames);
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top