I'm on the process of creating an API in much the same way Hanselman showed it could be done for Stackoverflow. I have a bunch EntityObject
Entity Framework generated classes and a DataService
thingy to serialize them to Atom and JSON. I would like to expose some generated properties via the web service. Think FullName as generated by concatenating First- and Lastname (but some are more complex). I have added these to a partial class extending the Entity Framework EntityObject and given them the [DataMemberAttribute()]
attribute, yet they don't show up in the service. Here's an example attribute (set
is thrown in for good measure, doesn't work without it either):
[DataMemberAttribute()]
public string FullName
{
get
{
return (this.Firstname ?? "") + " " + (this.Lastname ?? "");
}
set { ;}
}
According to these discussions on msdn social, this is a known issue. Has anyone found good workarounds or does anyone have suggestions for alternatives?