zs2020
zs2020

Reputation: 54543

About serialize the object having generic type in WCF

I implemented a generic way to get the object by id from Entities defined in Entity Framework.

But the problem is the object I got has a very weird type like this

{System.Data.Entity.DynamicProxies.MyEntity_C71732021C3A9D6A58BDB6087D29E98CFDE09DA9D53AF0892AFB7918AEF7E61F}

And WCF will fail when serialize this object as the type of MyEntity.

How to make the generic type to be the specific type I want?

Upvotes: 0

Views: 362

Answers (1)

Justin Niessner
Justin Niessner

Reputation: 245489

It sounds like you're using Entity Framework 4.0 POCO objects. If that's the case, MSDN has a great walk-through on how to get things working:

Walkthrough: Serialize POCO Proxies with WCF

Also take a look at:

Working with POCO Entities (pay close attention to the Serializing POCO Proxies section)

Upvotes: 1

Related Questions