Soft Delete This is not really a soft delete, but excludes entities based on what you specified in the Field attribute of an entity. The Field attribute now includes an Exclude property which can be used to restrict the types of entities that are returned from the data store. Supposing we have an Employee class and we do not want to be fetching employees whose Status property is Sacked, we would do the following mapping, so that the Rapid Runtime framework generate an exclusion query :

    [Entity("Employee")]
    public partial class Employee : Person {
        
        private String employeenumber;        
        private String grade;        
        private Int32 personid2;        
        
        [Field("EmployeeNumber")]
        public virtual String EmployeeNumber {
            get {
                return employeenumber;
            }
            set {
                this.employeenumber = value;
            }
        }

        [Field("Status", Exclude = "Sacked")]
        public virtual string Status
        {
            get;
            set;
        }
        
        [Field("Grade")]
        public virtual String Grade {
            get {
                return grade;
            }
            set {
                this.grade = value;
            }
        }
}

Having done that, when you issue a query on Employee entity, only employees whose status is not Sacked would be retrieved from the data store.

Last edited Feb 23, 2010 at 2:00 PM by ahmedsalako, version 5

Comments

No comments yet.