views:

67

answers:

1

Hi guys!

I have a .net4 application using EF4, I Expose my model through WCF using BasicHttpBinding (but this can be changed) that every time I try invoke this method my web server process start to grow in memory and the process die.

The problem is when the DataContractSeralizer trying to serialize my Entity (has some relationships) enter in a recursive stack. So, Is there any special configuration or something that i'm missing in order to server this Entity through WCF.

Here some extra information: Screenshot of my EF model: http://www.luisguerrero.net/stackoverflow/efmodel.jpg

public List<ExtendedSession> GetAllExtendedSessionByFilter(int id)
{
        QueryDataAccess<ExtendedSession, NextWebEntities> query = new QueryDataAccess<ExtendedSession, NextWebEntities>("ExtendedSession");
        List<ExtendedSession> result = query.GetAllByFilter(item => item.SessionId == id, "Rule");
        return result;
}
A: 

I generally solve this by serializing a projection of the data without any circular references, written as a LINQ query.

Craig Stuntz