Skip to end of metadata
Go to start of metadata

Due to the autoboxing inherent to all CLR languages it is impossible to represent NULL values for primitives types. It is common practice to provide SetFooNull and IsFooNull methods alongside a Foo property. Where are these in Neo?

By default they are not created but when you add the following snipped to your NeoSupport.vtl template they'll be there as expected.

 
#foreach($attribute in $entity.Attributes)
#if($attribute.AllowsNull && !$attribute.IsHidden)
	public virtual object ${attribute.DotNetName}Nullable
	{
		get { return Row["$attribute.ColumnName"]; }
		set { Row["$attribute.ColumnName"] = (value != null) ? (object)value : (object)DBNull.Value; }
	}

	public bool Is${attribute.DotNetName}Null()
	{
		return Row.IsNull("$attribute.ColumnName");
	}    

	public void Set${attribute.DotNetName}Null()
	{
		Row["$attribute.ColumnName"] = DBNull.Value;
	}    

#end
#end
 
Labels: