Private Shared Function UniqueIndex(Of T As SomeBusinessObject)(ByVal target As T, ByVal e As Csla.Validation.RuleArgs) As Boolean
Dim parent As SomeBusinessObjectList = CType(target.Parent, SomeBusinessObjectList)
If parent IsNot Nothing Then
For Each item As SomeBusinessObject In parent
If item.Name.ToUpperInvariant() _
= target.Name.ToUpperInvariant() _
AndAlso Not ReferenceEquals(item, target) Then
e.Description = e.PropertyFriendlyName & " must be unique."
Return False
End If
Next
End If
Return True
End Function
Copyright (c) Marimer LLC