Update :
Solution:
1: Create partial class of tableName.cs like e.g. tableName.custom.cs under Models.Context.
Add a new bool field to the model and decorate it with [NotMapped]:
[NotMapped]
public bool shortfield_tobool { get; set; }
2: Add a partial class to the controller of the table , tableNameController.Custom.cs.
Add the Read , Get and Update Methods to the partial class.
partial void OntableNameRead(ref IQueryable<Models.MyDataBase.tableName> items)
{
foreach (var item in items)
{
switch (item.shortfield)
{
case 1:
item.shortfield_tobool = true;
break;
case 0:
item.shortfield_tobool = false;
break;
default:
item.shortfield_tobool = false;
break;
}
}
}
partial void OntableNameGet(ref IQueryable<Models.MyDataBase.tableName> items)
{
foreach (var item in items)
{
switch (item.shortfield)
{
case 1:
item.shortfield_tobool = true;
break;
case 0:
item.shortfield_tobool = false;
break;
default:
item.shortfield_tobool = false;
break;
}
}
}
partial void OntableNameUpdated(Models.MyDataBase.tableName item)
{
switch (item.shortfield_tobool )
{
case true:
item.shortfield = 1;
break;
case false:
item.shortfield = 0;
break;
}
}
3: Add a partial class to Startup.cs : Startup.Custom.cs to expose the new field to Odata
partial void OnConfigureOData(ODataConventionModelBuilder builder) {
var tableN = builder.EntitySet<MyContext.Models.MyDataBase.tableName>("tableNameInDatabase");
tableN.EntityType.Property(od => od.shortfield_tobool);
}
In Radzen this field is not available in the designer , but you can add it manually by typing the name .
Hope that this helps someone else.