Strong-type Property

In NObject O/R Mapping persistence layer, physics type of database field will be mapped into native-type of native language, such as "Varchar" and "Text" are mapped into string, and "int" is mapped into int etc... The following is the sample of using strong-type property:

Product p = new Product(om);

decimal dPrice;

string sPrice;

 

// typed

p.UnitPrice = 100;

p.UnitPrice = int.Parse("100");

 

dPrice = p.UnitPrice;

sPrice = p.UnitPrice.ToString();

When the value of a field in database is null (null, not empty string), the strong-type property that corresponds to this field will transform accordingly:

Numeral Type: 0;

Character Type: empty string;

Boolean Type: false:

Date Type: no transform

Please use type-less property when it's indeed to judge if a property is null.

 

Related Topics

Using NObject Object Property