【问题标题】:How to connect to Realm Object Server from .NET code (Xamarin)?如何从 .NET 代码(Xamarin)连接到 Realm 对象服务器?
【发布时间】:2017-11-17 12:27:48
【问题描述】:

我的 Mac (192.168.100.61:9080 ip) 上有一个正在运行的 Realm 对象服务器,PC 上有 Xamarin 应用程序。 我想在 ROS 上保存/同步数据。 如何从代码连接到 ROS?

【问题讨论】:

标签: c# xamarin realm


【解决方案1】:

您需要登录/注册一个用户并打开一个同步的领域。比如:

// pass createUser: true to register rather than login
var credentials = Credentials.UsernamePassword("foo@bar.com", "super-secure", createUser: false);

// Login the user
var user = await User.LoginAsync(credentials, new Uri("http://192.168.100.61:9080"));

// Create a sync configuration for the Realm
// Notice the URL uses the realm scheme and not http
var config = new SyncConfiguration(user, new Uri("realm://192.168.100.61:9080/~/myrealm"));

// Finally, get the Realm instance
// This Realm will be kept in sync with the remote one
var realm = Realm.GetInstance(config);

更多详情,请查看documentation

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-03-09
    相关资源
    最近更新 更多