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.MyEn开发者_StackOverflow中文版tity_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?
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)
精彩评论