JayData:如何将代码从v1.3迁移到v1.5 [英] JayData : how to migrate code from v1.3 to v1.5
问题描述
我有一些可以在JayData 1.3中工作的代码.
I have some code which worked in JayData 1.3.
由于1.3版与Polymer的兼容性问题,我需要将JayData升级到1.5版.
I need to upgrade JayData to 1.5 due to the compatibility issues the 1.3 version has with polymer.
升级说明说,您可以使用"jaydata-compatibility.js
"脚本来将您的应用程序逐步从以前的版本升级到JayData 1.5.x",但是当我按照说明添加该应用程序时,我只是得到了错误" typeOrName requires a value other than undefined or null
",而实际上并没有完全无法帮助我完成升级.
The upgrade instructions say you can use the "jaydata-compatibility.js
" script to "upgrade your app to JayData 1.5.x from previous versions step-by-step", however when I add that in as described I simply get the error, "typeOrName requires a value other than undefined or null
", which actually doesn't help me step through the upgrade at all.
$data.Entity.extend('Cache', {
'id': { 'type': 'int', 'key': true, 'computed': true },
'url': { 'type': 'string' },
'method': { 'type': 'string', 'required': true },
'dts': { 'type': 'string', 'required': true },
'encryptMeth': { 'type': 'string' },
'data': { 'type': 'string' }
});
$data.EntityContext.extend('APIWrapperDB', {
'Cache': { 'type': $data.EntitySet, 'elementType': Cache }
});
var cacheDatabase = new APIWrapperDB('TheAPIWrapperDatabase');
cacheDatabase.onReady( function() { /* now my DB is ready */ };
此代码的JayData 1.5等价物是什么?
推荐答案
这是更新的代码段,由于JayData停止使用全局对象,因此我刚刚将您的实体定义声明为变量.
This is the updated snippet, I've just declared your entity definitions as variables as JayData stopped using global objects.
var Cache = data.Entity.extend('Cache', {
'id': { 'type': 'int', 'key': true, 'computed': true },
'url': { 'type': 'string' },
'method': { 'type': 'string', 'required': true },
'dts': { 'type': 'string', 'required': true },
'encryptMeth': { 'type': 'string' },
'data': { 'type': 'string' }
});
var APIWrapperDB = $data.EntityContext.extend('APIWrapperDB', {
'Cache': { 'type': $data.EntitySet, 'elementType': Cache }
});
var cacheDatabase = new APIWrapperDB('TheAPIWrapperDatabase');
cacheDatabase.onReady( function() { /* now my DB is ready */ };
这篇关于JayData:如何将代码从v1.3迁移到v1.5的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!