DbDataView FieldMapping Property NReco.Data Class Library Documentation
Query fields mapping to SQL expressions (optional).

Namespace: NReco.Data
Assembly: NReco.Data (in NReco.Data.dll) Version: 1.0.2
Syntax

public IDictionary<string, string> FieldMapping { get; set; }

Property Value

Type: IDictionary String, String 
Remarks

Field mappings are useful for defining SQL-calculated columns, or resolving ambigious columns names:
var dbView = new DbDataView(
    @"SELECT @columns FROM persons p
      LEFT JOIN countries c ON (c.id=p.country_id)
    @where[ WHERE {0}] @orderby[ ORDER BY {0}]") {
    FieldMapping = new Dictionary<string,string>() {
        // just id is ambigious
        {"id", "p.id"},  
        // SQL expression for calculated "expired" field
        {"expired", "CASE WHEN DATEDIFF(dd, p.added_date, NOW() )>30 THEN 1 ELSE 0 END" } 
    }
} );
See Also