/// <summary> /// Create a notification endpoint object in asynchronous mode. /// </summary> /// <param name="name">Name of notification endpoint</param> /// <param name="endPointType">Notification endpoint type</param> /// <param name="endPointAddress">Notification endpoint address</param> /// <returns>Task of creating notification endpoint.</returns> public Task <INotificationEndPoint> CreateAsync(string name, NotificationEndPointType endPointType, string endPointAddress) { NotificationEndPoint notificationEndPoint = new NotificationEndPoint { Name = name, EndPointType = (int)endPointType, EndPointAddress = endPointAddress }; notificationEndPoint.InitCloudMediaContext(_cloudMediaContext); DataServiceContext dataContext = DataContextFactory.CreateDataServiceContext(); dataContext.AddObject(NotificationEndPoints, notificationEndPoint); return(dataContext .SaveChangesAsync(notificationEndPoint) .ContinueWith <INotificationEndPoint>( t => { t.ThrowIfFaulted(); return (NotificationEndPoint)t.AsyncState; }, TaskContinuationOptions.ExecuteSynchronously)); }
internal NotificationEndPointCollection(CloudMediaContext cloudMediaContext) { _cloudMediaContext = cloudMediaContext; DataContextFactory = _cloudMediaContext.DataContextFactory; Queryable = DataContextFactory.CreateDataServiceContext().CreateQuery <NotificationEndPoint>(NotificationEndPoints); }