【问题标题】:Realm for Desktop apps适用于桌面应用程序的领域
【发布时间】:2016-10-26 14:07:08
【问题描述】:

有没有办法将realm.io 的 Realm 用于桌面 (WinForms/WPF) 应用程序?

我已经尝试了以下代码:

public partial class Form1 : Form
{
    private Realm realm;
    public Form1()
    {
        InitializeComponent();

        this.realm = Realm.GetInstance();
    }

    private void button1_Click(object sender, EventArgs e)
    {
        realm.Write(() =>
        {
            var jim = realm.CreateObject<Person>();
            var myDog = realm.CreateObject<Dog>();

            myDog.Name = "Fido";
            myDog.Owner = jim;
        });
    }
}

public class Dog : RealmObject
{
    public string Name { get; set; }
    public int Age { get; set; }
    public Person Owner { get; set; }
}

public class Person : RealmObject
{
    public string Name { get; set; }
    public IList<Dog> Dogs { get; }
}

但是当执行它时,VS 会显示一个PlatformNotSupportedException

【问题讨论】:

标签: c# wpf winforms realm


【解决方案1】:

抱歉,正如@EpicPandaForce 指出的那样,我们还不支持任何桌面环境。不过请留意那些 github 问题。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-03-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-07-19
    相关资源
    最近更新 更多