Entity Framework Одиночный результат ObjectResult - PullRequest
1 голос
/ 28 ноября 2010

У меня есть хранимая процедура, которая всегда возвращает одну строку
В настоящее время мой код выглядит примерно так

public void DoSomthing()
{
    ObjectResult<pDoesProductExist_Result> pDoesProductExistResults = tbsDBEntities.pDoesProductExist(itemCode);
                foreach (pDoesProductExist_Result pDoesProductExistResult in pDoesProductExistResults)
                {
                   return;
                }
...
}

Есть ли лучший способ сделать это?

1 Ответ

2 голосов
/ 28 ноября 2010
pDoesProductExist_Result exists = tbsDBEntities.pDoesProductExist(itemCode).Single();
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...