static void FillBehaviorInfo(IContractBehavior behavior, IWmiInstance existingInstance, out IWmiInstance instance) { Fx.Assert(null != existingInstance, ""); Fx.Assert(null != behavior, ""); instance = null; if (behavior is DeliveryRequirementsAttribute) { instance = existingInstance.NewInstance("DeliveryRequirementsAttribute"); DeliveryRequirementsAttribute specificBehavior = (DeliveryRequirementsAttribute)behavior; instance.SetProperty(AdministrationStrings.QueuedDeliveryRequirements, specificBehavior.QueuedDeliveryRequirements.ToString()); instance.SetProperty(AdministrationStrings.RequireOrderedDelivery, specificBehavior.RequireOrderedDelivery); if (null != specificBehavior.TargetContract) { instance.SetProperty(AdministrationStrings.TargetContract, specificBehavior.TargetContract.ToString()); } } else if (behavior is IWmiInstanceProvider) { IWmiInstanceProvider instanceProvider = (IWmiInstanceProvider)behavior; instance = existingInstance.NewInstance(instanceProvider.GetInstanceType()); instanceProvider.FillInstance(instance); } else { instance = existingInstance.NewInstance("Behavior"); } if (null != instance) { instance.SetProperty(AdministrationStrings.Type, behavior.GetType().FullName); } }
private static void FillBehaviorInfo(IContractBehavior behavior, IWmiInstance existingInstance, out IWmiInstance instance) { instance = null; if (behavior is DeliveryRequirementsAttribute) { instance = existingInstance.NewInstance("DeliveryRequirementsAttribute"); DeliveryRequirementsAttribute attribute = (DeliveryRequirementsAttribute)behavior; instance.SetProperty("QueuedDeliveryRequirements", attribute.QueuedDeliveryRequirements.ToString()); instance.SetProperty("RequireOrderedDelivery", attribute.RequireOrderedDelivery); if (null != attribute.TargetContract) { instance.SetProperty("TargetContract", attribute.TargetContract.ToString()); } } else if (behavior is IWmiInstanceProvider) { IWmiInstanceProvider provider = (IWmiInstanceProvider)behavior; instance = existingInstance.NewInstance(provider.GetInstanceType()); provider.FillInstance(instance); } else { instance = existingInstance.NewInstance("Behavior"); } if (instance != null) { instance.SetProperty("Type", behavior.GetType().FullName); } }