具有Typescript的Jaydata WebSql提供程序 [英] Jaydata WebSql Provider with Typescript

查看:68
本文介绍了具有Typescript的Jaydata WebSql提供程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在对OData存储使用jaydata和TypeScript,如此处所述:

I've been using jaydata with TypeScript against an OData store as described here: http://jaystack.com/blog/typescript-meets-odata-with-the-help-of-jaydata-and-jaysvcutil.

现在,我正在尝试扩展应用程序以使用本地存储(例如,webSql),但是看来打字稿声明文件仅允许实例化OData上下文.在定位到其他存储提供程序时如何使用声明文件?

Now, I'm trying to extend the application to use a local store as well (say, webSql) but it appears the typescript declaration file only allows for an OData context to be instantiated. How can I use the declaration file while targeting a different storage provider?

推荐答案

我为JayData工作.这么晚才回复很抱歉. 在JayData中,我们有一个称为本地"的虚拟"提供者.它隐藏了不同浏览器支持的不同本地存储技术,因此您不必担心它,也不必为IndexedDB,WebSQL和HTML5.localStorage编写代码.只需编写一次就可以了.

I work for JayData. Sorry for the late reply. In JayData we have a "virtual" provider called 'local'. It hides the different local storage technologies the different browsers support, so you don't have to worry about it and write code for IndexedDB, WebSQL and HTML5.localStorage. Just write it once and it will work.

您要做的就是更改服务的参数,如下所示:

All you have to do is to change the parameters of the service, like this:

var mydatabaseService = new mydatabase.mydatabaseService({
    name: 'local',
    databaseName: 'myitems'
});

有几件事要注意: -string主键不受支持(JayData不支持,但商店不支持) -如果您想要导航属性,那么当前只有sqLite支持它,因此您必须显式使用它(名称:"sqLite",而不是名称:"local"),并且在每个设备中都找不到sqlite.我们将很快在其他商店中实施导航.

There are a few things to be careful about: -string primary keys are not supported (not by JayData but by the stores) -if you want navigation properties then currently it is only supported by sqLite so you must use it explicit (name: 'sqLite' instead of name: 'local') and sqlite can not be found in every device. We will implement navigation in other stores soon.

这篇关于具有Typescript的Jaydata WebSql提供程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆