c# , Entity Framework Stored Procedure

c#, entity-framework, linq

Solution

This is because Entity Framework cannot guarantee that your stored procedure will always return a single row, so it's put into a `ObjectResult` which is just an enumerable collection. If you're always expecting a single result, you can use `db.GetParamAlerts().Single()` to get the result as `GetParamAlerts_Result`, or use any of the standard enumerable methods like `First()`, `FirstOrDefault()`, `SingleOrDefault()`, etc.

Problem

I am using Entity Framework. I have the following: ``` var db = new LikEntities(); GetParamAlerts_Result paramRslt = db.GetParamAlerts(); ``` `GetParamAlerts` is a stored procedure and it is of type ``` System.Data.Objects.ObjectResult<GetParamAlerts_Result> ``` Note the GetParamAlerts returns multiple rows. When I run the code above I the following error message : Cannot implicitly convert type: 'System.Data.Objects.ObjectResult' to 'PVT_Alert_Notification.GetParamAlerts_Result' Not sure how to resolve this.

Original source

Related problems