编辑:看到史蒂芬的博客文章在这里与样本下载代码:http://blog.stevensanderson.com/2012/03/06/single-page-application-packages-and-samples/
也不知道如何访问帮手,很想知道这样我就可以发挥它: - )
这似乎这样的伎俩现在:
<script src="../../Scripts/knockout-2.0.0.js" type="text/javascript"></script>
<script src="../../Scripts/upshot.js" type="text/javascript"></script>
<script src="../../Scripts/upshot.compat.knockout.js" type="text/javascript"></script>
<script type="text/javascript">
upshot.metadata({ "CLASSNAME:#NAMESPACE":{ "key": ["aId"],
"fields": {
"aId": { "type": "Int32:#System" },
"Title": { "type": "String:#System" },
"Description": { "type": "String:#System" },
"Effort": { "type": "Double:#System" }
}
}
});
var myDataSource = new upshot.RemoteDataSource({
providerParameters: {
url: "http://localhost:7018/api/CONTROLLERNAME",
operationName: "",
operationParameters: {}
},
entityType: "CLASSNAME:#NAMESPACE"
});
myDataSource.refresh(function (results) {
alert(results[0].Title());
});
</script>
您需要更换产品类别:与您的类名和命名空间#NAMESPACE,所以对于前充足:“WorkItem:#MySystem.Models”。
并与控制器的实际名称替换CONTROLLERNAME,在这个
public class MyTasksController : ApiController
的情况下,你需要根据与MyTasks
更换CONTROLLERNAME,并填补了东西的元数据中的模型对象。我希望代码示例很快上线,因为这有很多工作:-(
为您添加了upshot标签。 – 2012-02-19 09:41:09
是的,我也没有。我无法找到任何文档。我假设upshot.js是一个新生儿。 – tugberk 2012-02-19 13:47:52
你也可以看看这里:http://denverdeveloper.wordpress.com/category/upshot/ – gius 2012-07-13 15:44:18