dortzur
dortzur

Reputation: 1666

Entity Framework Single Result ObjectResult

I have a stored procedure which always returns a single row
Currently my code looks something like this

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

Is there a better way of doing this?

Upvotes: 1

Views: 2949

Answers (1)

Femaref
Femaref

Reputation: 61477

pDoesProductExist_Result exists = tbsDBEntities.pDoesProductExist(itemCode).Single();

Upvotes: 2

Related Questions