Up Customize the model

Specify the null entity

Last modified on August 15, 2012 17:21

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
Tags: Model
Created by DevForce on March 21, 2011 23:10

This wiki is licensed under a Creative Commons 2.0 license. XWiki Enterprise 3.2 - Documentation. Copyright © 2015 IdeaBlade