Data Types

Format Table Column Data

This example demonstrates how to customize the Data Access tier of your application so that the entire application uses a custom class to validate, format, and parse all values for a specific column in a Table. Specifically, this example demonstrates how to customize your application so that a column of a table only uses a custom display format to display them. The example uses very simple validation and formatting logic, but you can modify the sample code to implement your own business rules.
Table Name
Select a database table having currency column
Column Name
Select the name of the currency column that requires new display format
Applies to
DataAccessClass class
// Customization for ${Table Name}Access class.
// A custom column class that has a special "display" format.
public class MyCustomCurrencyColumn : BaseClasses.Data.CurrencyColumn 
    public MyCustomCurrencyColumn(BaseClasses.Data.CurrencyColumn col)
    : base(col.Number, col.InternalName, col.Name, col.TableDefinition, null, null, null) 
        this.IsIdentity = col.IsIdentity; 
        this.DbDataType = col.DbDataType; 
        this.DefaultValue = col.DefaultValue; 
        this.DatabaseDefaultValue = col.DatabaseDefaultValue; 
        this.DisplayFormat = col.DisplayFormat; 
        this.DbFormat = col.DbFormat; 
        this.IsRequired = col.IsRequired; 
        this.IsIndexed = col.IsIndexed; 
        this.IsUnique = col.IsUnique; 
        this.IsValuesReadOnly = col.IsValuesReadOnly; 
        this.IsValuesComputed = col.IsValuesComputed; 

    // Overridden to put angle brackets around the display string.
    public override string ToDisplayString(ColumnValue value, string format) 
        return string.Format("<{0}>", base.ToDisplayString(value, format)); 

// Overridden to customize this object's TableDefinition's ColumnList.
protected override void Initialize() 

    // Construct a custom column instance using the current ${Column Name}.
    MyCustomCurrencyColumn newCol = new MyCustomCurrencyColumn(this.${Column Name}Column); 

    // Replace the ${Column Name} with the custom column instance.
    int i; 
    i = this.TableDefinition.ColumnList.IndexOf(this.${Column Name}Column); 

Terms of Service Privacy Statement