I have a database with a table :
User { UserId, Name, Number, DateCreated, DateEffective, DateEnd, DateReplaced }
I expose the information in the database containing the table through WCF Data Services.
1) the columns : DateCreated, DateEffective, DateEnd, DateReplaced are for keeping historical records and as such should not appear to the clients using my WCF Data Service.
2) also, Whenever a client makes the query :
var q = from u in service.Users select u;
I want it to return only the users who have the DateEnd column set to null.
Is there any way to achieve that functionality ?
1 If you're going through WCF you're serializing to XML, right? So mark the properties that you don't want to be serialized as NonSerialized.
[NonSerialized()] public string test; [MSDN NonSerializedAttribute Class][1]
2 You'll have to expose a method for the client to access that has already filtered the null DateEnd columns out.
Such as
public class Service{
private List<User> _users;
public List<User> Users {
get{
from u in _users where u.DateEnd == null select u
}
}
...
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.