2
Answers

Returning IQueryable

Rich

Rich

12y
1.8k
1

When using an entity framework model that  is in the same project as the code below, everything works fine:

IQueryable<sample1> GetSample1()

{

return db.sample1;

}

But when referencing an Entity Framework model from an external project I get this error:

Cannot implicityly convert type 'System.Data.Objects.ObjectSet<ExternalProject.sample1>' to 'System.Linq.IQueryable<CurrentProject.sample1>'. An explicit conversion exists (are you missing a cast?)

I am a little confused by this. Can someone explain to me why this is happening.


Answers (2)