本文整理汇总了C#中Microsoft.WindowsAzure.StorageClient.CloudTableClient.GetDataServiceContext方法的典型用法代码示例。如果您正苦于以下问题:C# CloudTableClient.GetDataServiceContext方法的具体用法?C# CloudTableClient.GetDataServiceContext怎么用?C# CloudTableClient.GetDataServiceContext使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.WindowsAzure.StorageClient.CloudTableClient
的用法示例。
在下文中一共展示了CloudTableClient.GetDataServiceContext方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FriendshipRepository
public FriendshipRepository()
{
storage = CloudStorageAccount.Parse(ConfigurationManager.AppSettings["StorageConnectionString"]);
client = storage.CreateCloudTableClient();
client.CreateTableIfNotExist(TableName);
context = client.GetDataServiceContext();
}
示例2: PersistPrimeSum
public PersistPrimeSum()
{
tableClient = storageAccount.CreateCloudTableClient();
tableClient.CreateTableIfNotExist(TheTableName);
tableServiceContext = tableClient.GetDataServiceContext();
tableServiceContext.IgnoreResourceNotFoundException = true;
}
开发者ID:sseyalioglu,项目名称:AzureWebAndWorker_For_PrimeSumFinder_withScale,代码行数:7,代码来源:PersistPrimeSum.cs
示例3: PushServiceTokenRepository
public PushServiceTokenRepository()
{
storage = CloudStorageAccount.Parse(RoleEnvironment.GetConfigurationSettingValue("StorageConnectionString"));
client = storage.CreateCloudTableClient();
client.CreateTableIfNotExist(TableName);
context = client.GetDataServiceContext();
}
示例4: AzureStorageClient
public AzureStorageClient()
{
CloudStorageAccount account = CloudStorageAccount.Parse(CloudConfigurationManager.GetSetting("StorageConnectionString"));
mTableClient = account.CreateCloudTableClient();
mTableClient.CreateTableIfNotExist(TranslationTable);
mContext = mTableClient.GetDataServiceContext();
mContext.IgnoreResourceNotFoundException = true;
}
示例5: TableStorageSiteUrlRepository
public TableStorageSiteUrlRepository()
{
_storageAccount = CloudStorageAccount.Parse(
CloudConfigurationManager.GetSetting(_connectionStringName)
);
_tableClient = new CloudTableClient(_storageAccount.TableEndpoint.AbsoluteUri, _storageAccount.Credentials);
_tableClient.RetryPolicy = RetryPolicies.Retry(3, TimeSpan.FromSeconds(1));
_tableClient.CreateTableIfNotExist(_tableName);
_tableContext = _tableClient.GetDataServiceContext();
}
示例6: StorageWrapper
public StorageWrapper()
{
_storageAccount = CloudStorageAccount.Parse(
RoleEnvironment.GetConfigurationSettingValue(_connectionStringName)
);
_tableClient = new CloudTableClient(_storageAccount.TableEndpoint.AbsoluteUri,
_storageAccount.Credentials);
_tableClient.RetryPolicy = RetryPolicies.Retry(3, TimeSpan.FromSeconds(1));
_tableClient.CreateTableIfNotExist(_tableName);
_tableContext = _tableClient.GetDataServiceContext();
}
示例7: NotificationRepository
public NotificationRepository()
{
// Retrieve storage account from connection-string
storageAccount = CloudStorageAccount.Parse(Properties.Settings.Default.DataStorageConnectionString);
// Create the table client
tableClient = storageAccount.CreateCloudTableClient();
tableClient.CreateTableIfNotExist(tableName);
// Get the data service context
context = tableClient.GetDataServiceContext();
}
示例8: NotificationRepository
public NotificationRepository()
{
// Retrieve storage account from connection-string
storageAccount = CloudStorageAccount.Parse(
CloudConfigurationManager.GetSetting(Constants.DataStorageConnectionStringKey));
// Create the table client
tableClient = storageAccount.CreateCloudTableClient();
tableClient.CreateTableIfNotExist(tableName);
// Get the data service context
context = tableClient.GetDataServiceContext();
}
示例9: AzureStorageOld
public AzureStorageOld(string account, string key, string table, bool nagling = true)
{
this._account = this.GetStorageAccount(account, key);
EnableNagling(nagling);
this._client = _account.CreateCloudTableClient();
this._table = table;
this.CreateTable(table);
this._context = _client.GetDataServiceContext();
}
示例10: DatabaseManager
private DatabaseManager()
{
// Retrieve the storage account from the connection string
storageAccount = CloudStorageAccount.Parse(CloudConfigurationManager.GetSetting("StorageConnectionString"));
// Create the table client
tableClient = storageAccount.CreateCloudTableClient();
// Create the table if it doesn't exist
tableClient.CreateTableIfNotExist(tableName);
// Get the data service context
serviceContext = tableClient.GetDataServiceContext();
}
示例11: QueryLogTable
private static void QueryLogTable(CloudTableClient tableStorage)
{
TableServiceContext context = tableStorage.GetDataServiceContext();
DataServiceQuery query = context.CreateQuery<LogEntry>(TableStorageTraceListener.DIAGNOSTICS_TABLE)
.Where(entry => entry.PartitionKey.CompareTo(lastPartitionKey) > 0
|| (entry.PartitionKey == lastPartitionKey && entry.RowKey.CompareTo(lastRowKey) > 0))
as DataServiceQuery;
foreach (AzureDiagnostics.LogEntry entry in query.Execute())
{
Console.WriteLine("{0} - {1}", entry.Timestamp, entry.Message);
lastPartitionKey = entry.PartitionKey;
lastRowKey = entry.RowKey;
}
}
示例12: CreatePushNotificationTable
private static void CreatePushNotificationTable(CloudTableClient cloudTableClient)
{
cloudTableClient.CreateTableIfNotExist(UserTablesServiceContext.PushUserTableName);
// Execute conditionally for development storage only.
if (cloudTableClient.BaseUri.IsLoopback)
{
var context = cloudTableClient.GetDataServiceContext();
var entity = new PushUserEndpoint { UserId = "UserName", ChannelUri = "http://tempuri", TileCount = 0 };
context.AddObject(UserTablesServiceContext.PushUserTableName, entity);
context.SaveChangesWithRetries();
context.DeleteObject(entity);
context.SaveChangesWithRetries();
}
}
示例13: CreateUserPrivilegeTable
private static void CreateUserPrivilegeTable(CloudTableClient cloudTableClient)
{
cloudTableClient.CreateTableIfNotExist(PrivilegesTableServiceContext.UserPrivilegeTableName);
// Execute conditionally for development storage only.
if (cloudTableClient.BaseUri.IsLoopback)
{
TableServiceContext context = cloudTableClient.GetDataServiceContext();
var entity = new UserPrivilege { UserId = "UserId", Privilege = "Privilege" };
context.AddObject(PrivilegesTableServiceContext.UserPrivilegeTableName, entity);
context.SaveChangesWithRetries();
context.DeleteObject(entity);
context.SaveChangesWithRetries();
}
}
示例14: GetRdfMetadataColumnNamespace
public static List<TableColumnsMetadataEntity> GetRdfMetadataColumnNamespace(string entitySet)
{
CloudTableClient tableClient = new CloudTableClient(s_account.TableEndpoint.ToString(), s_account.Credentials);
TableServiceContext tableServiceContext = tableClient.GetDataServiceContext();
string queryTemplate = "{0}?$filter=entityset eq '{1}'";
string query = string.Format(queryTemplate, DataLoaderConstants.TableColumnsMetadataTableName, entitySet);
List<TableColumnsMetadataEntity> resultsQuery = tableServiceContext.Execute<TableColumnsMetadataEntity>(new Uri(query, UriKind.Relative)).ToList();
if (resultsQuery.Count > 0)
{
return resultsQuery;
}
else
{
return null;
}
}
示例15: GeneratePastEventLogMessagesForConferenceManagement
public void GeneratePastEventLogMessagesForConferenceManagement(
CloudTableClient messageLogClient, string messageLogName,
string conferenceManagementConnectionString,
IMetadataProvider metadataProvider, ITextSerializer serializer)
{
retryPolicy.ExecuteAction(() => messageLogClient.CreateTableIfNotExist(messageLogName));
// set the creation date to just before releasing V1 (previous month).
var eventCreationDate = new DateTime(2012, 04, 01, 0, 0, 0, DateTimeKind.Utc);
var generatedEvents = this.GenerateMissedConferenceManagementIntegrationEvents(conferenceManagementConnectionString);
foreach (var evt in generatedEvents)
{
// generate events in ascending order. If there is a conflict when saving (currently silently swallowed by AzureEventLogWriter),
// then the migration process is being run for the second time, which is wrong.
// TODO: what happens if the process crashes middleway.
eventCreationDate = eventCreationDate.AddSeconds(1);
var metadata = metadataProvider.GetMetadata(evt);
var entry = new MessageLogEntity
{
PartitionKey = eventCreationDate.ToString("yyyMM"),
// could have a prefix instead of suffix to be able to search
RowKey = eventCreationDate.Ticks.ToString("D20") + "_Generated",
CreationDate = eventCreationDate.ToString("o"),
MessageId = null,
CorrelationId = null,
SourceType = null,
SourceId = evt.SourceId.ToString(),
AssemblyName = metadata[StandardMetadata.AssemblyName],
FullName = metadata[StandardMetadata.FullName],
Namespace = metadata[StandardMetadata.Namespace],
TypeName = metadata[StandardMetadata.TypeName],
Kind = StandardMetadata.EventKind,
Payload = serializer.Serialize(evt),
};
var context = messageLogClient.GetDataServiceContext();
context.AddObject(messageLogName, entry);
retryPolicy.ExecuteAction(() => context.SaveChanges());
}
}