expressappframework-devexpress-dot-persistent-dot-validation-dbf7b496.md
Contains values specifying how criteria string parameters used in RuleRangeAttribute and RuleValueComparisonAttribute constructors are treated.
Namespace : DevExpress.Persistent.Validation
Assembly : DevExpress.Persistent.Base.v25.2.dll
NuGet Package : DevExpress.Persistent.Base
public enum ParametersMode
Public Enum ParametersMode
| Name | Description |
|---|---|
Value |
A criteria string is treated as a string.
|
| Expression |
A criteria string is treated as an expression. So, you can use the Criteria Language Syntax.
|
The following example demonstrates how to pass this enumeration value to the RuleRange attribute:
using System;
using DevExpress.Persistent.Validation;
//...
[RuleRange("LastSevenDays_RuleRange", "Save", "AddDays(LocalDateTimeToday(), -7)",
"LocalDateTimeToday()", ParametersMode.Expression)]
public virtual DateTime LastSevenDays { get; set; }
// Make sure that you use options.UseChangeTrackingProxies() in your DbContext settings.
using System;
using DevExpress.Persistent.Validation;
//...
private DateTime lastSevenDays;
[RuleRange("LastSevenDays_RuleRange", "Save", "AddDays(LocalDateTimeToday(), -7)",
"LocalDateTimeToday()", ParametersMode.Expression)]
public DateTime LastSevenDays {
get { return lastSevenDays; }
set { SetPropertyValue(nameof(LastSevenDays), ref lastSevenDays, value); }
}
//...
See Also