Using WCF RIA Services SP1 how can I use a stored procedure through a complex entity structure type?

I struggle with using stored procedures in WCF RIA SP1 services through complex entity types of Entity Framework 4. I only found a couple of useful links here and here . Prior to SP1, I had to return a collection of Entities (not complex types). I was forced to modify sproc to return fields that exactly match an existing entity. I want to avoid modifying existing sprocs.

I added an import of the EF function, pointing to my existing sproc. Now, instead of returning a collection of objects, I am returning a complex type called GetMySproc_Result. I feel that I have skipped the step for now because I expect that I can create a domain service containing the appropriate types, elements, and methods. Instead, when I generate a domain service class, nothing is related to my complex type. The class is not generated from the new base class ComplexObject.

Note. I installed the beta version of SP1, but the RIA services still work the same way as before (the gen code has not changed or improved). Is there a way to confirm that SP1 is installed?

I would appreciate a step-by-step guide on creating, generating code, and consuming a complex type of EF from an existing stored procedure using RIA Services SP1. Thanks in advance.

+4
source share
1 answer

Tried to work for an hour, all the steps exactly match what the links say, but one important thing to make it work is to add the get method to your domain service class, as shown below:

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

I did this job in RTM for RTF WCF Ria Services.

hope this helps.

0
source

Source: https://habr.com/ru/post/1336218/


All Articles