entity framework - ObjectSet and ResultSet on stored procedure on EF and Domain Service -


In EF4, the default object set is available for each unit. For example, I have a table employee, which has a garretted unit model, will create an object-set on the EF employee. Then wcf using ria service, like the default query:

public IQueryable GetEmployee () {This return.ObjectContext.Employees; }

With ObjectSet, I can apply such results on:

  return it. Object contact Staff. Include ("department");  

Then I call an archived method MySearchForEmployee and import it as a function. The results are mapped to the unit employee, while calling the function, the result will be the result area, not the object set.

I want to make available the same method for the domain service by calling stored procedure:

  Public IQueryable & lt; Employeer & gt; GetMySearch (string keyword) {return.ObjectContext.MySearchForEmployee (keywords). Include ("department"); }  

But I can not do syntax checking because the code event is not above.

I tried the following ways to convert the result type:

  var result = this.ObjectContext. MySearchForEmployee (keyword); Var objsets = (ObjectSet; lt; Employee & gt;) Result;  

Then I get the error: Type 'System.Data.Objects.ObjectResult' can not be converted into 'System.Data.Objects.ObjectSet'

How to implement it There is no reason to use any object, because you can not include multiple unit sets in a query. From a stored procedure this unit is not supported in the framework

You can try this project, there are extensions to load many unit sets from a query in it.


Comments