I'm working with a WebApi project in C# (EF code first) and I'm using OData.
I have a "User" model with Id, Name, LastName, Email, and Password.
In controller for example I have this code:
// GET: odata/Users
[EnableQuery]
public IQueryable<User> GetUsers()
{
return db.Users;
}
If I call /odata/Users I'll get all the data: Id, Name, LastName, Email, and Password.
How can I exclude Password from results but keep available in controller to make Linq queries?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…