/// <summary> /// Create an instance of the HealthRecordItemChangedSubscription class, specifying the delivery mechanism and the /// set of type ids on which to send event notifications. /// </summary> /// <param name="commonSubscriptionData">The common subscription data to associate with this subscription.</param> /// <param name="typeIds">The type ids on which to send event notifications</param> public HealthRecordItemChangedSubscription(CommonSubscriptionData commonSubscriptionData, IList<Guid> typeIds) : base(commonSubscriptionData) { HealthRecordItemChangedFilter filter = new HealthRecordItemChangedFilter(typeIds); if (filter.TypeIds.Count != 0) { _filters.Add(filter); } }
/// <summary> /// Create an instance of a Subscription by deserializing the subscription XML. /// </summary> /// <remarks> /// The returned type will be a type derived from Subscription, such as the <see cref="HealthRecordItemChangedSubscription"/> class. /// </remarks> /// <param name="subscriptionNavigator">The xml representation to deserialize.</param> /// <returns>The subscription.</returns> /// /// <exception cref="ArgumentNullException"> /// The <paramref name="subscriptionNavigator"/> parameter is <b>null</b>. /// </exception> /// /// <exception cref="ArgumentException"> /// The <paramref name="subscriptionNavigator"/> parameter XML does not contain /// a subscription node. /// </exception> /// /// <exception cref="InvalidOperationException"> /// The <paramref name="subscriptionNavigator"/> parameter XML has an unrecognized /// subscription type. /// </exception> public static Subscription Deserialize(XPathNavigator subscriptionNavigator) { Validator.ThrowIfNavigatorNull(subscriptionNavigator); // find out what kind of node we have, and go from there... Subscription subscription = null; CommonSubscriptionData commonSubscriptionData = null; foreach (XPathNavigator typeSpecificNav in subscriptionNavigator.SelectChildren(XPathNodeType.Element)) { switch (typeSpecificNav.Name) { case "record-item-changed-event": subscription = new HealthRecordItemChangedSubscription(null); subscription.ParseXml(subscriptionNavigator); break; case "common": commonSubscriptionData = new CommonSubscriptionData(); commonSubscriptionData.ParseXml(subscriptionNavigator); break; default: throw new InvalidOperationException( String.Format( CultureInfo.InvariantCulture, ResourceRetriever.GetResourceString("UnrecognizedSubscriptionType"), typeSpecificNav.Name)); } } if (subscription != null) { subscription.CommonSubscriptionData = commonSubscriptionData; } return subscription; }
/// <summary> /// Create a subscription instance with the specified common data. /// </summary> /// <param name="commonSubscriptionData">The common data to use.</param> internal Subscription(CommonSubscriptionData commonSubscriptionData) { _commonItemSubscriptionData = commonSubscriptionData; }