Customizing Entity Platform Code

I have a database with the following table:

User { UserId, Name, Number, DateCreated, DateEffective, DateEnd, DateReplaced } 

I provide information in a database containing this table through WCF data services.

1) columns: DateCreated, DateEffective, DateEnd, DateReplaced are for storing historical records and, as such, should not be displayed to clients using my WCF data service.

2) also, when the client makes a request:

  var q = from u in service.Users select u; 

I want it to return only those users whose DateEnd column is set to null.

Is there any way to achieve this functionality?

+4
source share
1 answer

1 If you go through WCF, you are serialized in XML, right? Therefore, check the properties that you do not want to serialize as NonSerialized.

 [NonSerialized()] public string test; [MSDN NonSerializedAttribute Class][1] 

2 You will need to open a method for client access that has already filtered the DateEnd null columns.

For instance,

 public class Service{ private List<User> _users; public List<User> Users { get{ from u in _users where u.DateEnd == null select u } } ... 

}

+4
source

All Articles