tags:

views:

42

answers:

1

I have a method AddEntity(object o). I am figuring out which entity type it is on the server side using reflection and such and adding it to the database. I am using Self Tracking entities. However this is the error I am getting.

"Element contains data from a type that maps to the name . The deserializer has no knowledge of any type that maps to this name."

This is a lie. I have the entity on the server side, and I have the entity on the client side as a proxy. I am just passing it as an object because I have generalized the AddEntity method.

I am using object because generics are not serializable. So I cannot do something like this:

[OperationContract] AddObject(T entity)

Any suggestions are most welcome.

A: 

No. This is not how the WCF works. WCF serializes entity to wire format and deserializes the entity on the other side. Deserialization process needs to know what type have to be deserialized - such information is not part of serialized data. This type is resolved from operation parameter or return type. Object is not allowed.

Ladislav Mrnka