views:

13

answers:

1

in DB, a SP return a bit result. like:

declare @temp bit; 
--......
return @temp;   

in EF, impport this SP as function and return scarlars Boolean. in domain service call this function as:

public bool CallSP()
{
 var result =  this.ObjectContext.MySp();
 return (bool)result;
}

then get error as:

Cannot convert type 'System.Data.Objects.ObjectResult<bool?>' to 'bool'

how to resolve this problem?

A: 

Try this:

public bool? CallSP()
{
     var result =  this.ObjectContext.MySp();
     return (bool?)result;
}
Leniel Macaferi