The null entity (informally known as the nullo) is a special version of an entity class that represents the "entity not found". Every entity class defines its own null entity.
You don't have to do anything to define the null entity. The default properties of the nullo are adequate for most purposes. But you can change any property value if you don't like the default by overriding the UpdateNullEntity method in the partial class.
An EntityManager will call this method exactly once when it first needs a nullo of the given type. In this example, we make the nullo's Customer.CompanyName property return "N/A".
C# | public partial class Customer { //... // Custom implementation for NullEntity protected override void UpdateNullEntity() { this.CompanyName = "N/A"; } } |
VB | Partial Public Class Customer '... ' Custom implementation for NullEntity Protected Overrides Sub UpdateNullEntity() Me.CompanyName = "N/A" End Sub End Class |