Hi,
I've just started using Entity Framework rather than my normal NHiberante to see how EF works and so far I'm having lots of problems but one in particular is detaching an object and keeping the related child objects.
I bought the O'Reilly Entity Framework book which tells you "yes entity framework by default doesn't keep the object graph when you detach" but it doesn't show how you how to keep the graph! Thanks O'Reilly thats really useful.
Anyway if anyone can help that would be great, code below:
using (var creativeWorkshopEntities = new CreativeWorkshopEntities())
{
var q = from c in creativeWorkshopEntities.Job.Include("Files")
where c.Id == jobId
select c;
var job = q.First();
creativeWorkshopEntities.Detach(job);
return job;
}
Thanks!
Dan