Binding upshot to a Web API in a different project

那年仲夏 提交于 2019-12-05 15:01:16

You can use the following:

upshot.dataSources = upshot.dataSources || {};

upshot.metadata({"ModelType:#Namespace":
    {
     "key":["Id"],
     "fields":    
        {"Id":{"type":"Int32:#System"},
         "IpAddress":{"type":"String:#System"},
         "Name":{"type":"String:#System"}
        }
    } (and so on, just map everything)
});

var dataSource = new upshot.RemoteDataSource({
    providerParameters: 
        { url: "Your URL", 
          operationName: "Method Name, example: GetCustomers" },
    entityType: "ModelType:#Namespace",
    bufferChanges: true (or false, whatever you like),
    dataContext: undefined,
    mapping: {}
});

If I were you, If I could I would temporarily create a solution with the Controller project in it, then I would check the JS generated by the UpshotContext helper and copy that into your pages (which is what I did to have the result above, anyway).

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!