Referring to this question, let's say we have the following scenario -
A model class User that implements IUser
[MetadataType(typeof(IUser))]
public class User : IUser
And a repository that handles saving, retrieving etc. of this from whichever datastore we want to use
public class UserRepository : IRepository<User>
IQueryable<User> GetAUserBySomeCriteriaOrOther(int aParam, string anotherParam);
Further on we would have a controller and perhaps a view on top as well, each expecting an instance of IQueryable<User>
.
My questions is thus:
What are the advantages/disadvantages of passing the results back from the repository as (say) an IQueryable<User>
compared to an IQueryable<IUser>
?
My reason for asking is that most examples/demos I see would use IQueryable<User>
, but this seems to me to be introducing a coupling between higher layers and whichever method I use to generate the User
class. Say I want to change from Linq-to-Sql to Entity Framework - is that not then a big headache?