簡體   English   中英

Windows Azure移動服務多個插入,如何獲取范圍標識

[英]Windows Azure Mobile Services multiple inserts, how to get the scope identity

在使用Windows Azure移動服務的其中一個表的插入腳本中,我想獲取剛插入的ID,並將其用於在另一個表(一對多樣式)中插入與子相關的數據

任何想法?? 提前致謝

function insert(item, user, request) {
request.execute({
    success: function() {
        var id = item.id;
        console.log("The new item's id is: ", id);
        request.respond();
    }
});

}

請注意,您還將獲得插入服務器腳本中的項目的ID:

    var theNewRow = {
        youProperty1: 'inserted',
        yourProperty2: 'in server script'
    };

    yourTable.insert(theNewRow, {
        success: function()
        {
            console.log('the row id' + theNewRow.id);
        } 
    });

卡洛斯(Carlos)在這篇文章中介紹了如何處理1:n關系: http : //blogs.msdn.com/b/carlosfigueira/archive/2012/09/11/supporting-complex-types-in-azure-mobile-services-clients-實現-1-n-table-relationships.aspx

順便說一句,您可以在此處找到與移動服務相關的帖子的集合:aka.ms/CommonWAMS

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM