DataContractSerializer Error using Entity Framework 4.0 with WCF 4.0

前端 未结 5 1724
灰色年华
灰色年华 2020-12-01 03:14

I am attempting to retrieve a list of objects from Entity Framework via WCF, but am receiving the following exception:

There was an error while trying to serialize p

5条回答
  •  孤街浪徒
    2020-12-01 04:12

    When using the DbContext API for Code First (EF 4.3) I had to do:

    public class MyClass : DbContext
    {
        public MyClass()
        {
            base.Configuration.ProxyCreationEnabled = false;
        }
    }
    

提交回复
热议问题