WCF Data Service, serialize additional properties on from Entity Framework partial classes?

I had the same issue exposing Entity objects over a WCF service and used the workaround you linked to here which is to add the following attribute to the properties to force them to be serialized.

I had the same issue exposing Entity objects over a WCF service and used the workaround you linked to here which is to add the following attribute to the properties to force them to be serialized. Global::System.Runtime.Serialization. DataMemberAttribute() I haven't found any 'nicer' ways of getting this working.

For example, given an entity called Teacher with fields Title, Forenames and Surname you can add a partial class for Teacher something like: public partial class Teacher { global::System.Runtime.Serialization. DataMemberAttribute() public string FullName { get { return string. Format("{0} {1} {2}", Title, Forenames, Surname); } set { } } } Then as long as your WCF Service interface references this class then the extra properties are serialised and available for consumers of the service.E.g.

OperationContract List GetTeachers().

Hm, doesn't seem to be working though. What entities are you serilizing? – friism Sep 14 '10 at 9:01 I've added a more detailed example to the answer above.

– Nelson Sep 14 '10 at 16:57 I think this requires EF4 to work. @Nelson - can you confirm that you are have . NET framework 4.0?

– Antony ghsky Oct 21 '10 at 2:03 This answer is specific to WCF Services, not WCF Data Services. – Aligned Feb 11 at 21:40.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions