Are TypedViews from Stored Procedures ever null?

Posts   
 
    
ianvink
User
Posts: 393
Joined: 15-Dec-2006
# Posted on: 06-Feb-2013 22:41:24   

Using Entity Framework to generate Stored Procedure results (TypedViews).

In this case, do we need to check if the result of the call is ever null?

Is this code safe:


var x = context.GetSomeThingTypedView()
use x

or do we need to:


var x = context.GetSomeThingTypedView()
if(x!=null)
     use x

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 07-Feb-2013 07:23:03   

This is more an EF question, but I don't see why it should return null according to http://msdn.microsoft.com/en-us/library/bb739018.aspx

Anyway you should test it, maybe asking for a TPV that you know returns 0 rows. It should return an object with 0 rows.

David Elizondo | LLBLGen Support Team