In a DB, I have a SP return a bit result, like:
declare @temp bit;
--......
return @temp;
In EF, I imported this SP as a function and return scarlars Boolean. In domain service I called this function as:
public bool CallSP()
{
var result = this.ObjectContext.MySp();
return (bool)result;
}
Then got this error:
Cannot convert type 'System.Data.Objects.ObjectResult<bool?>' to 'bool'
How开发者_开发知识库 do I resolve this problem?
Try this:
public bool? CallSP()
{
var result = this.ObjectContext.MySp().First();
return (bool?)result;
}
Try this:
public bool? CallSP()
{
var result = this.ObjectContext.MySp();
return (bool?)result;
}
精彩评论