var esqOpportunity = new EntitySchemaQuery(userConnection.EntitySchemaManager, "Opportunity");
esqOpportunity.AddColumn("Id");
var opportunityCollection = esqOpportunity.GetEntityCollection(userConnection);
Guid opportunityId = Guid.Empty;
if (opportunityCollection.Count > 0) {
opportunityId = opportunityCollection[0].GetTypedColumnValue("Id");
}
Почему при попытке получить значение opportunityCollection[0].GetTypedColumnValue("Id") выдается ошибка: Value "Id" was not found?
В профайлере в запросе Id записи выбирается.
Если написать такой код:
var esqOpportunity = new EntitySchemaQuery(userConnection.EntitySchemaManager, "Opportunity");
esqOpportunity.AddAllSchemaColumns();
var opportunityCollection = esqOpportunity.GetEntityCollection(userConnection);
Guid opportunityId = Guid.Empty;
if (opportunityCollection.Count > 0) {
opportunityId = opportunityCollection[0].GetTypedColumnValue("Id");
}
В этом случае ошибки не возникает.
Можно ли получить Id записи каким-то другим образом, но чтобы был первый вариант с выбором одной колонки?