我有一个类,该类是从RealmObject继承的,带有Birthday属性,该类是使用DatePicker输入的。但是Realm仅适用于DateTimeOffset。我怎样才能优雅地转换所有这些?
XAML
<DatePicker MinimumDate="01/01/1400"
MaximumDate="11/14/2019"
Date="{Binding Author.Birthday}" />
班主任
public class Author : RealmObject
{
//[PrimaryKey]
public string Id { get; set; } = Guid.NewGuid().ToString();
public string Name { get; set; }
public string PhotoPath { get; set; }
[Ignored]
public Image Photo { get; set; }
public DateTimeOffset? Birthday { get; set; }
public IList<Book> Books { get; }
public bool IsFavorite { get; set; }
}