开发者

Using WCF RIA Services SP1 how do I consume a stored procedure via an entity framework complex type?

I'm struggling with stored procedure use in SP1 of WCF RIA Services via Entity Framework 4 Complex Types. I found only a couple of helpful links here and here. Prior to SP1 I had to return a collection of Entities (not Complex Types). I was forced to modify the sproc to return fields that exactly match an existing entity. I want to avoid changing existing sprocs.

I've added an EF function import pointing to my existing sproc. Now instead of returning a collection of entities I'm returning a complex type called GetMySproc_Result. I sense that I'm missing a step at this point because I am expecting to be able to generate a Domain Service containing corresponding types, members and methods. Instead, when I generate the domain service class there is nothing relating to my complex type. No class is generated derived from the new ComplexObject base class.

Note: I installed SP1 Beta but RIA Services still works just like before (code gen hasn't changed or improved). Is there a way for me to confirm the SP1 is installed?

I'd appreciate a step by step guide on how to create, code gen and consume an EF complex type from an existing stored procedure using RIA Services SP1. Th开发者_C百科anks in advance.


Tried to work with for about an hour, all the steps are exactly the same as what the links say, but one important thing to get this to work is to add a get method to your domain service class like below:

public IEnumerable<ComplexType> GetStoreProcedureResults(object parameter)
{
    return this.ObjectContext.StoredProcedure(parameter);
}

I made this work on WCF Ria Services SP1 RTM.

hope it helps.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜