Exemplo n.º 1
0
 public IEnumerable <SyncStatus> RetrieveSyncStatuses()
 {
     return(_table.Query
            .Where(s => s.PartitionKey.Equals(AzureRoleEnvironment.DeploymentId(), StringComparison.OrdinalIgnoreCase))
            .ToList()
            .Select(s => s.ToModel())
            .ToList());
 }
Exemplo n.º 2
0
        public void UpdateStatus(string webSiteName, SyncInstanceStatus status, Exception lastError = null)
        {
            var syncStatus = new SyncStatus
            {
                SiteName       = webSiteName,
                RoleInstanceId = AzureRoleEnvironment.CurrentRoleInstanceId(),
                DeploymentId   = AzureRoleEnvironment.DeploymentId(),
                Status         = status,
                IsOnline       = true,
                LastError      = lastError
            };

            _table.AddOrUpdate(syncStatus.ToRow());
        }
Exemplo n.º 3
0
        public static SyncStatusRow ToRow(this SyncStatus model)
        {
            if (model == null)
            {
                return(null);
            }

            var deploymentId   = string.IsNullOrWhiteSpace(model.DeploymentId) ? AzureRoleEnvironment.DeploymentId() : model.DeploymentId;
            var roleInstanceId = string.IsNullOrWhiteSpace(model.RoleInstanceId) ? AzureRoleEnvironment.CurrentRoleInstanceId() : model.RoleInstanceId;

            return(new SyncStatusRow(deploymentId, roleInstanceId, model.SiteName)
            {
                Status = model.Status.ToString(),
                IsOnline = model.IsOnline,
                LastError = model.LastError.TraceInformation()
            });
        }