Class documentation

This example uses Oracle HR schema.

Code

Column representation, one-to-one, one-to-many relationships, and all specifications for mapping a table.

#region JobHistory
[Serializable]
[ECRUD.NoteSchema("HR")]
[ECRUD.NoteTable("JOB_HISTORY")]
[ECRUD.PrimaryKey("EMPLOYEE_ID", SequenceType = ECRUD.Enums.SequenceType.Max)]
public class JobHistory
{
    //Column
    [ECRUD.Column("EMPLOYEE_ID")]
    [ECRUD.NoteDataType(ECRUD.Enums.DataTypes.NUMBER)]
    public long? EmployeeId { get; set; }

    //Column
    [ECRUD.Column("START_DATE")]
    [ECRUD.NoteDataType(ECRUD.Enums.DataTypes.DATE)]
    public DateTime? StartDate { get; set; }

    //Column
    [ECRUD.Column("END_DATE")]
    [ECRUD.NoteDataType(ECRUD.Enums.DataTypes.DATE)]
    public DateTime? EndDate { get; set; }

    //Column
    [ECRUD.Column("JOB_ID")]
    [ECRUD.NoteDataType(ECRUD.Enums.DataTypes.VARCHAR2)]
    public string JobId { get; set; }

    //Column
    [ECRUD.Column("DEPARTMENT_ID")]
    [ECRUD.NoteDataType(ECRUD.Enums.DataTypes.NUMBER)]
    public long? DepartmentId { get; set; }

    //One to one mapping
    [ECRUD.OneToOne("JOBS", "JOB_ID", "JOB_ID")]
    public Job Job { get; set; }

    //One to one mapping
    [ECRUD.OneToOne("DEPARTMENTS", "DEPARTMENT_ID", "DEPARTMENT_ID")]
    public Department Department { get; set; }
}
#endregion