I try to sync data, from my Xamarin Apps and my database…
I read my record dietResult from the Db then try
dietResult.PopulateWith(request.DietDto);
dietResult.PopulateInstance(request.DietDto);
dietResult = request.Audit.ConvertTo<Table.DietResult>();
dietResult is a reference in audit table.
Db.Save(audit, true);
I don’t find the correct method that make sens…
When Save Insert no issues, but when Save do an update I loose my DietId.
So my question does PopulateWith or PopulateInstance or ConvertTo will assign to zero my DietId on Update ?
My table definition:
[Alias("REIBeef_DietResult")]
public class DietResult : IBackOfficeField, IDietResult
{
private Guid? rowId;
[Unique, Sequence("DietId"), ReturnOnInsert]
public long DietId { get; set; }
public int AccessFiber { get; set; }
public int MainFiber { get; set; }
public int FiberQuality { get; set; }
public int FiberRegularity { get; set; }
public bool ValidCategory { get; set; }
[Default(OrmLiteVariables.SystemUtc)]
public DateTime? CreatedDateUtc { get; set; }
[Default(OrmLiteVariables.SystemUtc)]
public DateTime? UpdatedDateUtc { get; set; }
[PrimaryKey]
public Guid? RowId
{
get => rowId = rowId ?? Guid.NewGuid();
set => rowId = value;
}
}
My Dto:
public class DietDto : IBackOfficeField, IDietResult
{
public int AccessFiber { get; set; }
public int MainFiber { get; set; }
public int FiberQuality { get; set; }
public int FiberRegularity { get; set; }
public bool ValidCategory { get; set; }
public DateTime? CreatedDateUtc { get; set; }
public DateTime? UpdatedDateUtc { get; set; }
public Guid? RowId { get; set; }
}