I was upset when I read that you can't use navigation properties on ComplexTypes with WCF.
http://social.msdn.microsoft.com/Forums/en-US/adodotnetentityframework/thread/b9e14bc6-b248-48e1-b9e3-af7600537110
With DevForce I was able to get it to work.
My complex types look like this:
AccountProjection
int AccountId
IEnumerable<ReceivableProjection> Receivables
ReceivableProjection
int ReceivableId
By default, this will not work, you will get this error:
The server encountered an error processing the request. The exception
message is 'The property 'Receivables' on a complex type
'AccountProjection' is not a
valid property. Navigation properties are not supported on complex
types.'. See server logs for more details.
To get past this I have simply added this to my entity manager partial class:
public EntityQuery<ReceivableProjection> ReceivableProjections
{
get { return null; }
}
public EntityQuery<AccountProjection> AccountProjections
{
get { return null; }
}
Then I added this to my web service in InitializeService:
config.SetEntitySetAccessRule("ReceivableProjections", EntitySetRights.All);
config.SetEntitySetAccessRule("AccountProjections", EntitySetRights.All);
Now it works, as long as I make sure to use $expand=Receivables in my query :)