Skip to content

Latest commit

 

History

History
23 lines (18 loc) · 907 Bytes

PREVENTQUERYATTRIBUTE.md

File metadata and controls

23 lines (18 loc) · 907 Bytes

PreventQuery Attribute

The PreventQuery attribute is optional. This is used to prevent some or all Query operators on a model's property.

The following example will prevent all Query operators on the User FormerAddress property.

public class User
{
  [PreventQuery]
  public ICollection<Address>? FormerAddresses { get; set; }
}

The following example will prevent Operator.Contains on the User Name property. This is useful for operators that may cause performance hits or properties that are not indexed and may also lead to poor performance when fetching the data.

public class User
{
  [PreventQuery(Operator.Contains)]
  public String? Name { get; set; }
}