Department
Example model for ECRUD.
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 Department
[Serializable]
[ECRUD.NoteSchema("HR")]
[ECRUD.NoteTable("DEPARTMENTS")]
[ECRUD.PrimaryKey("DEPARTMENT_ID", SequenceType = ECRUD.Enums.SequenceType.Max)]
public class Department
{
//Column
[ECRUD.Column("DEPARTMENT_ID")]
[ECRUD.NoteDataType(ECRUD.Enums.DataTypes.NUMBER)]
public long? DepartmentId { get; set; }
//Column
[ECRUD.Column("DEPARTMENT_NAME")]
[ECRUD.NoteDataType(ECRUD.Enums.DataTypes.VARCHAR2)]
public string DepartmentName { get; set; }
//Column
[ECRUD.Column("LOCATION_ID")]
[ECRUD.NoteDataType(ECRUD.Enums.DataTypes.NUMBER)]
public long? LocationId { get; set; }
//One to one mapping
[ECRUD.OneToOne("LOCATIONS", "LOCATION_ID", "LOCATION_ID")]
public Location Location { get; set; }
}
#endregion