WCF with Entity Framework Error

后端 未结 1 1652
北恋
北恋 2021-01-25 11:11

Error: The ObjectContext instance has been disposed and can no longer be used for operations that require a connection.

I am trying to create a WCF service with Entity F

相关标签:
1条回答
  • 2021-01-25 11:30

    Do you have navigation properties in your Person class? Did you disable lazy loading? Otherwise it will probably try to load content for navigation properties during serialization and it fails because of closed context.

    To your other questions:

    [DataMemberAttribute()] and [DataMember] are same. It is just shorter name.

    [DataContractAttribute(IsReference=true)] and [DataContract] are not same. IsRefrence allows tracking circular references in navigation properties. Without this parameter circular reference causes never ending recursion.

    0 讨论(0)
提交回复
热议问题