private static void CheckAndUpdateMetadataLastUpdateDate(string metadataSet, string entitySet, string entityKind, DateTime lastUpdateDate, DataLoaderParams Params) { var context = new TableContext(s_account.TableEndpoint.ToString(), s_account.Credentials, Params) { RetryPolicy = RetryPolicies.RetryExponential(RetryPolicies.DefaultClientRetryCount, RetryPolicies.DefaultClientBackoff) }; string query = string.Format(s_metadataEntityQueryTemplate, metadataSet, entitySet, entityKind); List <TableEntity> results = context.Execute <TableEntity>(new Uri(query, UriKind.Relative)).ToList(); if (results.Count == 1) { DateTime oldLastUpdateDate = new TableMetadataEntity(results[0]).LastUpdateDate; if (oldLastUpdateDate > lastUpdateDate) { throw new MetadataOutdatedException(oldLastUpdateDate, lastUpdateDate); } results[0].UpdateProperty(DataLoaderConstants.PropNameLastUpdateDate, lastUpdateDate); context.UpdateObject(results[0]); context.SaveChanges(); } else if (results.Count > 1) { throw new DuplicateEntityException(query); } }
private static void CheckAndUpdateMetadataLastUpdateDate(string metadataSet, string entitySet, string entityKind, DateTime lastUpdateDate, DataLoaderParams Params) { var context = new TableContext(s_account.TableEndpoint.ToString(), s_account.Credentials, Params) { RetryPolicy = RetryPolicies.RetryExponential(RetryPolicies.DefaultClientRetryCount, RetryPolicies.DefaultClientBackoff) }; string query = string.Format(s_metadataEntityQueryTemplate, metadataSet, entitySet, entityKind); List<TableEntity> results = context.Execute<TableEntity>(new Uri(query, UriKind.Relative)).ToList(); if (results.Count == 1) { DateTime oldLastUpdateDate = new TableMetadataEntity(results[0]).LastUpdateDate; if (oldLastUpdateDate > lastUpdateDate) throw new MetadataOutdatedException(oldLastUpdateDate, lastUpdateDate); results[0].UpdateProperty(DataLoaderConstants.PropNameLastUpdateDate, lastUpdateDate); context.UpdateObject(results[0]); context.SaveChanges(); } else if (results.Count > 1) { throw new DuplicateEntityException(query); } }
public MatadataControlViewModel(DataLoaderParams parameters) { _instance = parameters.TableMetadataEntity; EntitySet = _instance.EntitySet; }