简体   繁体   English

使用LINQ查询Azure MobileServiceSyncTable

[英]Query Azure MobileServiceSyncTable with LINQ

I currently have an Azure mobile backend working with my Xamarin.ios application. 我目前有一个与我的Xamarin.ios应用程序一起使用的Azure移动后端。 However, I am currently trying to Query my table when one column value equals a certain value and I want to return the whole row. 但是,我目前正在尝试查询我的表,当一个列的值等于某个值并且我想返回整行时。 It return the right amount of rows but I cannot actually access the information it has returned and it just return the class List. 它返回正确的行数,但是我实际上无法访问它返回的信息,而只是返回类List。 I cant seem to get tot he actual values its returning (if it is that is...) 我似乎无法了解他返回的实际值(如果是……)

Here is the method that queries the table and should return the value: 这是查询表并应返回值的方法:

public async Task<List<EasyPm_TpPmResults>> RetrieveExistingData()
{
    //Initialize & Sync
    await Initialize();
    await SyncPmResults();

    var query = easyPmTpLocalResultsTable.Where(item => item.TurbineIdent == FormResults.TurbineIdentity);

    var results = await query.ToListAsync();

    foreach (var item in results)
    {
        Console.WriteLine(item);
    }

    return null;
}

I know it returns null currently but thats just until I get the method working. 我知道它当前返回null,但这就是直到我使方法起作用为止。 The below screenshot shows what prints to the console: 以下屏幕截图显示了打印到控制台的内容:

应用程序运行期间的控制台输出

Hopefully someone can point out something stupid im doing! 希望有人可以指出我在做些蠢事!

Thanks Jamie 谢谢杰米

Console.WriteLine(item); will not print out the values of each property, it just calls ToString() , which by default just returns the name of the class. 不会打印出每个属性的值,它只会调用ToString() ,默认情况下,它仅返回类的名称。 Use the debugger to inspect the properties, or explicitly call item.Property1 etc 使用调试器检查属性,或显式调用item.Property1

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM