微软同步框架离线存储与SQLite数据库



我遵循了Microsoft Sync Framework工具和教程。

http://code.msdn.microsoft.com/Sync-Framework-Toolkit-4dc10f0e

我试图使用SQLite作为我的客户端数据库,对于我的服务器,我有SQL server 2008 R2,我配置了我的服务器数据库,我能够运行一个例子,浏览器缓存本地存储。但我想使用SQLite数据库。when clicking on the "sync" button, the SQLite database in the Android devices should be synchronized with SQL Server database。你能给我指路吗?

 this.sendRequest = function (serviceUri, successCallback, errorCallback, dir) {
        TraceObj("[" + dir + " Request]:", serviceUri, this.dataObject());
        // Construct HTTP POST request
        var xmlHttp = new XMLHttpRequest();
        xmlHttp.open("POST", serviceUri);
        xmlHttp.setRequestHeader("Accept", "application/json");
        xmlHttp.setRequestHeader("Content-Type", "application/json");
        // Handle success & error response from server and then callback
        xmlHttp.onreadystatechange = function () {
            if (xmlHttp.readyState == 4) {
                if (xmlHttp.status == 200) {
                    var res = new SyncFormatter();
                    if (res.parse(xmlHttp.responseText)) {
                        TraceObj("[" + dir + " Response]:", serviceUri, res.dataObject());
                        alert("[" + dir + " Response]:", serviceUri, res.dataObject());
                        successCallback(res);
                        return;
                    }
                }
                TraceMsg("[" + dir + " Response Error]: ", xmlHttp.status + " Response: " + xmlHttp.responseText);
                errorCallback(xmlHttp.responseText);
            }
        };
        xmlHttp.send(this.toString());
    };
}

在上面我得到xmlHttp。

没有现成的sqlite同步提供程序,所以如果您想使用它作为您的客户端数据库,您将不得不自己构建一个。

如果您已经下载了Sync Framework Toolkit,您将找到一个SQL CE的示例同步提供程序,您可以在编写自己的SQL lite同步提供程序时使用它。

最新更新