IgnoreAttribute Class

This attribute is used to mark properties that should be ignored as a parameter for an insert and/or update stored procedure for an entity.

Definition

Namespace: EWSoftware.EntityFramework.DataAnnotations
Assembly: EWSoftware.EntityFramework (in EWSoftware.EntityFramework.dll) Version: 2025.11.12.0
public sealed class IgnoreAttribute : Attribute
Inheritance
Object    Attribute    IgnoreAttribute

Remarks

This allows additional properties not present in the result set or the underlying table being updated to be excluded when performing inserts and updates. Typically, both parameters are set to false but it is possible to set one or the other to true to include the property for insert or updates if required.

The attribute will usually be applied to properties in the type but can be applied to the class or structure with a property name specified to ignore inherited properties that should not be considered for inserts and updates. The attribute can be applied multiple times if there are multiple properties to ignore.

Example

C#
[LoadAllStoredProcedure("spStateCodes"), InsertStoredProcedure("spStateCodeAddUpdate"),
  UpdateStoredProcedure("spStateCodeAddUpdate"), DeleteStoredProcedure("spStateCodeDelete")]
public sealed class StateCode : ChangeTrackingEntity
{
    // The state code
    [Key]
    public string State
    {
        get;
        set => this.SetWithNotify(value, ref field);
    } = String.Empty;

    // The state description
    public string StateDesc
    {
        get;
        set => this.SetWithNotify(value, ref field);
    } = String.Empty;

    // True if in use and cannot be deleted, false if not.  This is a column in the
    // load all stored procedure and we'll ignore it for inserts and updates.    
    [Ignore(true, true)]
    public bool IsInUse
    {
        get;
        set => this.SetWithNotify(value, ref field);
    }
}
C#
// This entity has a HasErrors property inherited from ObservableValidator that needs to be
// ignored for inserts and updates.  Since we don't have direct access to it, we use the
// attribute on the entity type and specify the property name as well.
[LoadAllStoredProcedure("spStateCodes"), InsertStoredProcedure("spStateCodeAddUpdate"),
  UpdateStoredProcedure("spStateCodeAddUpdate"), DeleteStoredProcedure("spStateCodeDelete"),
  Ignore(true, true, PropertyName = nameof(HasErrors))]
public sealed class StateCode : ObservableValidator
{
    ...
}

Constructors

IgnoreAttribute Initialize a new instance of the attribute using the given settings

Properties

ForInsert This read-only property gets the ignored state of the property for insert stored procedures
ForUpdate This read-only property gets the ignored state of the property for update stored procedures
PropertyName This property is used when applied to a class or structure to specify a property name that should be ignored that does not appear directly in the type such as an inherited property.
TypeIdWhen implemented in a derived class, gets a unique identifier for this Attribute.
(Inherited from Attribute)

Methods

EqualsReturns a value that indicates whether this instance is equal to a specified object.
(Inherited from Attribute)
GetHashCodeReturns the hash code for this instance.
(Inherited from Attribute)
GetTypeGets the Type of the current instance.
(Inherited from Object)
IsDefaultAttributeWhen overridden in a derived class, indicates whether the value of this instance is the default value for the derived class.
(Inherited from Attribute)
MatchWhen overridden in a derived class, returns a value that indicates whether this instance equals a specified object.
(Inherited from Attribute)
ToStringReturns a string that represents the current object.
(Inherited from Object)

Extension Methods

ToNullableT This is used to convert objects to null values if they are equal to null, DBNull.Value, or the default value for the given type.
(Defined by DatabaseExtensions)
ToStringOrNull This is used to convert an object to a string and return either the string value if not empty, or null if it is an empty string.
(Defined by DatabaseExtensions)

See Also