AzureTicker.Worker.Model.Repositories.NotificationRepository.GetByRowKey C# (CSharp) Метод

GetByRowKey() публичный Метод

public GetByRowKey ( string rowKey ) : Notification
rowKey string
Результат AzureTicker.Worker.Model.TableStorage.Notification
        public Notification GetByRowKey(string rowKey)
        {
            if (!string.IsNullOrEmpty(rowKey))
            {
                return
                    (from n in context.CreateQuery<Notification>(tableName) select n).AsTableServiceQuery<Notification>().Where(n => n.RowKey == rowKey).FirstOrDefault();
            }
            else
            {
                return null;
            }
        }

Usage Example

 public string GetExistingUsername(string rowKey, string notificationUri)
 {
     string retVal = string.Empty;
     using (INotificationRepository rep = new NotificationRepository())
     {
         Notification notification = rep.GetByRowKey(rowKey);
         if (notification != null)
         {
             retVal = notification.UserName;
             notification.NotificationUri = notificationUri;
             notification.LastVerification = DateTime.UtcNow;
             rep.Update(notification);
             rep.SaveChanges();
         }
     }
     return retVal;
 }