Deepak Pathak

Deepak Pathak

  • NA
  • 108
  • 28.5k

Could not load 'Microsoft.Practices.EnterpriseLibrary.Common

Apr 14 2010 5:48 AM
Hi,
I have a DataContract class, on which I have defined 4 event handler methods as shown below:
//[OnSerializing] and [OnSerialized] marked method not getting called
DataContract class
  1. [DataContract]  
  2. public class Customer  
  3. {  
  4. [DataMember]  
  5. public int customerID;  
  6. [DataMember]  
  7. public string customerName;  
  8. [DataMember]  
  9. public long phoneNumber;  
  10. [OnSerializing]  
  11. private void OnSerializing(StreamingContext context)  
  12. {  
  13. //This is not getting called.  
  14. }  
  15. [OnSerialized]  
  16. private void OnSerialized(StreamingContext context)  
  17. {  
  18.   
  19.             //This is not getting called.  
  20.   
  21.   
  22. }  
  23. [OnDeserializing]  
  24. private void OnDeserializing(StreamingContext context)  
  25. {  
  26.   
  27.         //I know this gets override by OnDeserialized method.  
  28. customerName = "This is set again in OnDeserializing.";  
  29. }  
  30. [OnDeserialized]  
  31. private void OnDeserialized(StreamingContext context)  
  32. {  
  33.   
  34.         //This is working fine.  
  35. customerName = "This is set again in OnDeserialized.";  
  36. }  

Service class
  1. public class Booking : IBooking  
  2. {  
  3. public string bookTicket(Customer cust)  
  4. {  
  5. return String.Format("Dear {0}, your order has been received by us. " +  
  6. "You will receive a confirmation SMS shortly on your phone no- {1}", cust.customerName, cust.phoneNumber);  
  7. }  

Any ideas why the above 2 Serialization methods are not getting called when invoked through client.
Regards,
Deepak