WCF serialization Information outside the class definition

Suppose this simple scenario: My client already has a .net application running and he / she wants to provide some functions through WCF. So he gives me an assembly spanning an open class that exposes a method of following.

OrderDetail GetOrderDetail (int orderId) // Suppose OrderDetail has {ProductId, Quantity, Amount)

Now I want some OrderDetail (Amount) members not to be serialized. According to http://msdn.microsoft.com/en-us/library/aa738737.aspx , the way to do this is with the [DataContract] and [DataMember] / [IgnoreDataMember] attributes. However, this is not an option for me, because I can not change the source code of the client. So I'm looking for a way to specify which members I want to serialize outside, outside the type definition. Something that should look like this:

    [OperationContract]
    [IgnoreMember(typeof(OrderDetail), "Amount" )]
    OrderDetail QueryOrder(int orderId){
          return OrderDetail.GetOrderDetail(orderId)  
    }

Is there any way? Thanks Bernaba

+3
2

, DTO , , , .

, , WCF ,

, OrderDetailDto class OrderDetail, . OrderDetailDto DataContract DataMember ( , WCF OrderDetail)

, DTO- > Client Client Objects- > DTO

, , ( , , , - ), , - DTO, ( ), , , , DTO , ( , ).

, - . , DTO, -.

, DTO , , , .

+4

All Articles