Class DenyExpandAttribute
Names navigation properties a client may not expand from this entity type. Everything else is still permitted.
[AttributeUsage(AttributeTargets.Class, Inherited = true, AllowMultiple = true)]
public class DenyExpandAttribute : Attribute
- Inheritance
-
DenyExpandAttribute
- Inherited Members
Remarks
The counterpart of AllowExpandAttribute, and the better choice when a type has
many navigations and only one or two must not be reachable - an Order whose
Employee carries salary, say. A name that appears in both attributes on the same type
is a contradiction and throws.
[DenyExpand(nameof(Employee))]
public class Order {
public Employee Employee { get; set; } // refused
public ICollection<OrderDetail> OrderDetails { get; set; }
}
Constructors
DenyExpandAttribute(params string[])
Name the navigations a client may not expand from this type.
public DenyExpandAttribute(params string[] navigations)
Parameters
navigationsstring[]The navigation property names, as declared on this type.
Properties
Navigations
The navigation property names this type refuses.
public string[] Navigations { get; }
Property Value
- string[]