Current filter:
                                You should refresh the page.
                                  • Description:
                                    The value combination of several properties in my object must be unique. If I were creating a database, I'd define a unique index against several columns. How to implement a multi-key unique index in XPO?

                                    Answer:
                                    You should use the Indexed attribute with the Unique parameter. It must be applied to one of the properties of your composed index. The names of other properties must be specified delimiting them with semicolons as the first parameter.

                                    [C#]
                                    using DevExpress.Xpo; public class Person : XPObject { [Indexed("FirstName;BirthDate", Unique=true)] public string LastName = string.Empty; public string FirstName = string.Empty; public DateTime BirthDate; }
                                    [VB.NET]
                                    Imports DevExpress.Xpo Public Class Person Inherits XPObject <Indexed("FirstName;BirthDate", Unique:=True)> _ Public LastName As String = String.Empty Public FirstName As String = String.Empty Public BirthDate As DateTime End Class

                                    See Also:
                                    How to add a unique constraint to a property
                                    How to create a persistent object for a database table with a compound key
                                    How to make user-friendly object identifiers

                                0 Solutions

                                Creation Date Importance Sort by