SP with RIA
public System.Data.Objects.ObjectResult<SP1_Result> SP1()
{
System.Data.Objects.ObjectResult<SP1_Result> result = this.ObjectContext.SP1();
return result;
}
When I compile the project, I only got one error saying SP1_Result does not have a Key. So I added a SP1_Result metadata class and tagged the Key field:
[MetadataTypeAttribute(typeof(SP1_Result.SP1_ResultMetadata))]
public partial class SP1_Result
{
internal sealed class SP1_ResultMetadata
{
[Key]
public int MyId;
}
}
After this, I can compile without problem. When I checked Client Side generated code, I can see SP1_Result is generated as Entity class. DomainContext.SP1Query and DomainContext.SP1_Results are available.
The query function also can be written as :
public IQueryable<SP1_Result> SP1()
{
return this.ObjectContext.SP1().AsQueryable();
}