I have just published a Nuget package which adds property promotion features to Service Bus WCF programing model.

image

Once you added the package to your project you can use the PromotedProperty attribute to mark your properties as promoted. The package supports promotion from both complex & primitive arguments. In addition to PromotedPropertyAttribute you also need to stick PropertyPromotionBehavior on each method of your service contract.

Following service contract captures the sample usage.

  1. public class Order
  2. {
  3.     public double Amount { get; set; }
  4.     [PromotedProperty]
  5.     public string ShipCity { get; set; }
  6. }
  7.  
  8. [ServiceContract]
  9. public interface IOrderService
  10. {
  11.     [OperationContract(Name = "SubmitFlat", IsOneWay = true)]
  12.     [PropertyPromotionBehavior]
  13.     void Submit(double amount, [PromotedProperty] string shipCity);
  14.  
  15.     [OperationContract(IsOneWay = true)]
  16.     [PropertyPromotionBehavior]
  17.     void Submit(Order order);
  18. }

Enjoy…