I have set up my POCOs and I have marked their public properties as virtual and I am successfully getting Proxies most of the time (95%) but randomly I am getting EF return some proxies and some non-proxies.
Recycling the app pool when this happens will then fix this instance of the error and it will go away for an amount of time. Then it will re-occur in some other random (it seems) place.
What can cause this sort of behaviour?
alt text http://www.freeimagehosting.net/uploads/36c95af3c7.jpg
Thanks, Kohan
Solved it (im getting in the habit of almost giving up, posting here and then solving it)
Anyway, when I was adding a new Question i was using something like
var q = new Question()
this was then being stored as a non-proxy. In the end i found out by creating a new Question on the ObjectContext like sovar q = ObjectContext.CreateObject<Question>();
causes it to be a proxy and works just fine and dandy.Hope this helps someone,
Cheers,
Kohan.
A helpful source : http://blogs.msdn.com/b/adonet/archive/2009/06/10/poco-in-the-entity-framework-part-3-change-tracking-with-poco.aspx (read the comments)