EF4 Learning Objects and WCF Serialization Create Stack Overflow

I am trying to work on customization but no luck.

Step 1)

I launched a new solution with the WCF Service Application.

Step 2)

In this project, I added the edmx file and create a very simple model:
Entity Parent with ID and DisplayName Child
object with ID and name ChildDisplayName Association from parent to child, from 1 to m, resulting in NavigationProperties on both objects. I created the database without any problems. After the generation, I injected one Parent object with two related child objects manually into the database.

Step 3)

I added code generation using the ADO.NET Self-Tracking Entity Generator . I know that this should be done in different assemblies, but in order to do it directly and simply, I translated all this into one project (WCF project)

Step 4)

I just changed the IService interface to create a simple get

    [OperationContract]
    Parent GetRootData(Int32 Id);

In the appropriate implementation, I take the page object from the context and return it:

    using (PpjSteContainer _context = new PpjSteContainer() )
    {
        return _context.ParentSet.Include("Child").Single(x => x.Id == Id);
    }

Problem:

If now I run this project (Service1.svc start page), VS2010 automatically generates a test client to call the service. But as soon as I call the service, I get a StackOverflowException! Server-side debugging looks fine until it returns an object graph.

Include ( "" ), , , , Child . , . , , ( , , )...
, , , .

, , - , .

P.S.

  • , - "[DataContract (IsReference = true)]"
  • Lazy-Loading "false" edmx

Edit:
WCF, , IIS. , .
, . , , , , , , ...

+3
1

. .

0

All Articles