Entity Framework 4 + POCO with custom classes and WCF contracts (serialization problem)

Posted by eman on Stack Overflow See other posts from Stack Overflow or by eman
Published on 2010-11-08T07:46:42Z Indexed on 2011/01/04 14:53 UTC
Read the original article Hit count: 251

Yesterday I worked on a project where I upgraded to Entity Framework 4 with the Repository pattern. In one post, I have read that it is necessary to turn off the custom tool generator classes and then write classes (same like entites) by hand. That I can do it, I used the POCO Entity Generator and then deleted the new generated files .tt and all subordinate .cs classes. Then I wrote the "entity classes" by myself.

I added the repository pattern and implemented it in the business layer and then implemented a WCF layer, which should call the methods from the business layer. By calling an Insert (Add) method from the presentation layer and everything is OK. But if I call any method that should return some class, then I get an error like (the connection was interrupted by the server).

I suppose there is a problem with the serialization or am I wrong? How can by this problem solved?

I'm using Visual Studio S2010, Entity Framework 4, C#.

UPDATE:

I have uploaded the project and hope somebody can help me! link text

UPDATE 2:

My questions:

  1. Why is POCO good (pros/cons)?
  2. When should POCO be used?
  3. Is POCO + the repository pattern a good choice?
  4. Should POCO classes by written by myself or could I use auto generated POCO classes?

© Stack Overflow or respective owner

Related posts about c#

Related posts about wcf