RuleCombinationOfPropertiesIsUniqueAttribute.MessageTemplateCombinationOfPropertiesMustBeUnique Property

Specifies the text to be written in the Validation Error window when the current rule is broken.

Namespace: DevExpress.Persistent.Validation

Assembly: DevExpress.Persistent.Base.v18.2.dll

Declaration

public string MessageTemplateCombinationOfPropertiesMustBeUnique { get; set; }
Public Property MessageTemplateCombinationOfPropertiesMustBeUnique As String

Property Value

Type Description
String

A string value representing the text to be written to the Validation Error window when a rule is broken.

Remarks

When defining a RuleCombinationOfPropertiesIsUnique rule via the RuleCombinationOfPropertiesIsUniqueAttribute in code or in the Model Editor, you can specify a custom definition to be displayed in the Vaidation Error window for the broken rule. To do this, set the CustomMessageTemplate property. However, the list of the found objects will not be displayed. To display them, specify the MessageTemplateCombinationOfPropertiesMustBeUnique property instead of the CustomMessageTemplate property. The following code demonstrates this:

[RuleCombinationOfPropertiesIsUnique("SampleRule", 
    DefaultContexts.Save, "Description, Id",             
    MessageTemplateCombinationOfPropertiesMustBeUnique = 
    "Objects with the same combinations of the " + 
    "'Description' and 'Id' properties must not exist.")]
public class SampleClass : BaseObject {
    //...

To customize the format that is used to list the found objects in the Validation Error window, use the RuleCombinationOfPropertiesIsUniqueAttribute.FoundObjectMessageFormat and RuleCombinationOfPropertiesIsUniqueAttribute.FoundObjectMessagesSeparator properties.

There is a set of format items you can use in message templates. For instance, when using the {TargetObject} format item, the validated object will be inserted at runtime. For details, refer to the RuleBaseAttribute.CustomMessageTemplate property description.

See Also