This project is read-only.

Convert ObjectSet<T> to LinqQuery<T>

Oct 14, 2009 at 7:38 PM

How can I convert an ObjectSet<T> to a LinqQuery<T>?

I've tried a direct cast but Visual Studio doesn't like that.

 

Thanks in advance.

Oct 16, 2009 at 5:09 AM

The ObjectSet is not a query. Therefore you can't cast it to a LinqQuery. Why would you want to convert a ObjectSet to a LinqQuery?

Oct 21, 2009 at 3:52 PM
littleguru wrote:

The ObjectSet is not a query. Therefore you can't cast it to a LinqQuery. Why would you want to convert a ObjectSet to a LinqQuery?

Right now I use an ObjectSet for any stored procedures

.GetObjectSet<myObject>( new SqlQuery( "EXEC spGetResults" ) );

But I've got no clue how to run a stored procedure using the .GetPersistents method. If it's possible to do this then all my problems will be solved!

 

Oct 23, 2009 at 6:30 AM

That is not doable. LINQ does not work with stored procedures. What you can do is to do queries with LINQ in memory (LINQ on IEnumerable) once you have the objects loaded in the ObjectSet.