实体书写的注意事项
[Chloe.Annotations.TableAttribute("MN_FloDrawing")]
//上面一行代码表示,查询时对应的表名
public class Vw_MN_FloDrawing:BindableBase
{
private int _id;
/// <summary>
/// 表示对应主键的字段,默认识别的是ID
/// </summary>
[Chloe.Annotations.ColumnAttribute("ID", IsPrimaryKey = true)]
public int ID
{
get => _id;
set => SetProperty(ref _id, value);
}
private string _projectNo;
/// <summary>
/// 表示查询实体时忽略此字段
/// </summary>
[Chloe.Annotations.NotMappedAttribute]
public string ProjectNo
{
get => _projectNo;
set => SetProperty(ref _projectNo, value);
}
}
上面的样式的实体代码
1.context.Insert(mainFlowData);时识别的是不带NotMappedAttribute的表字段
2.context.Query<Vw_BD_FloPriceOfCommonditiesItems>().Where(w => w.MainID == flowData.ID).ToList().ToObservableCollection();

浙公网安备 33010602011771号