本文整理汇总了C#中Microsoft.WindowsAzure.StorageClient.CloudTableClient类的典型用法代码示例。如果您正苦于以下问题:C# CloudTableClient类的具体用法?C# CloudTableClient怎么用?C# CloudTableClient使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CloudTableClient类属于Microsoft.WindowsAzure.StorageClient命名空间,在下文中一共展示了CloudTableClient类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PushServiceTokenRepository
public PushServiceTokenRepository()
{
storage = CloudStorageAccount.Parse(RoleEnvironment.GetConfigurationSettingValue("StorageConnectionString"));
client = storage.CreateCloudTableClient();
client.CreateTableIfNotExist(TableName);
context = new TableServiceContextV2(client.BaseUri.ToString(), client.Credentials);
}
示例2: InitializeStorage
internal static bool InitializeStorage()
{
try
{
// 仅为测试目的,如果我们不在计算仿真程序中运行该服务,我们始终使用 dev 存储.
if (RoleEnvironment.IsAvailable)
{
CloudStorageAccount.SetConfigurationSettingPublisher((configName, configSetter) =>
{
configSetter(RoleEnvironment.GetConfigurationSettingValue(configName));
});
StorageAccount = CloudStorageAccount.FromConfigurationSetting("DataConnectionString");
}
else
{
StorageAccount = CloudStorageAccount.DevelopmentStorageAccount;
}
CloudBlobClient blobClient = new CloudBlobClient(StorageAccount.BlobEndpoint, StorageAccount.Credentials);
CloudBlobContainer container = blobClient.GetContainerReference("videostories");
container.CreateIfNotExist();
CloudQueueClient queueClient = new CloudQueueClient(StorageAccount.QueueEndpoint, StorageAccount.Credentials);
CloudQueue queue = queueClient.GetQueueReference("videostories");
queue.CreateIfNotExist();
CloudTableClient tableClient = new CloudTableClient(StorageAccount.TableEndpoint.AbsoluteUri, StorageAccount.Credentials);
tableClient.CreateTableIfNotExist("Stories");
return true;
}
catch (Exception ex)
{
Trace.Write("错误初始化存储: " + ex.Message, "Error");
return false;
}
}
示例3: Initialize
public static void Initialize()
{
CloudStorageAccount account = CloudConfiguration.GetStorageAccount(AzureConnectionStrings.DataConnection);
// Tables
var cloudTableClient = new CloudTableClient(account.TableEndpoint.ToString(), account.Credentials);
cloudTableClient.CreateTableIfNotExist<ExpenseExpenseItemEntity>(AzureStorageNames.ExpenseTable);
cloudTableClient.CreateTableIfNotExist<ExpenseExportEntity>(AzureStorageNames.ExpenseExportTable);
// Blobs
CloudBlobClient client = account.CreateCloudBlobClient();
client.RetryPolicy = RetryPolicies.Retry(3, TimeSpan.FromSeconds(5));
var container = client.GetContainerReference(AzureStorageNames.ReceiptContainerName);
container.CreateIfNotExist();
container = client.GetContainerReference(AzureStorageNames.ExpenseExportContainerName);
container.CreateIfNotExist();
// Queues
CloudQueueClient queueClient = account.CreateCloudQueueClient();
queueClient.RetryPolicy = RetryPolicies.Retry(3, TimeSpan.FromSeconds(5));
CloudQueue queueReference = queueClient.GetQueueReference(AzureStorageNames.ApprovedExpenseMessage);
queueReference.CreateIfNotExist();
queueReference = queueClient.GetQueueReference(AzureStorageNames.PoisonApprovedExpenseMessage);
queueReference.CreateIfNotExist();
queueReference = queueClient.GetQueueReference(AzureStorageNames.NewReceiptMessage);
queueReference.CreateIfNotExist();
queueReference = queueClient.GetQueueReference(AzureStorageNames.PoisonNewReceiptMessage);
queueReference.CreateIfNotExist();
}
示例4: LogActivity
public async Task<bool> LogActivity(LogItem logItem)
{
var tableStorage = new CloudTableClient(_storageAccount.TableEndpoint.AbsoluteUri, _storageAccount.Credentials);
#region Update to Parallel Tasks (not consistent)
/*
List<Task> tasks = new List<Task>();
tasks.Add(Task.Factory.StartNew(() => logItemTask("byactivity", logItem)));
tasks.Add(Task.Factory.StartNew(() => logItemTask("bytime", logItem)));
tasks.Add(Task.Factory.StartNew(() => logItemTask("byip", logItem)));
tasks.Add(Task.Factory.StartNew(() => logItemTask("byuser", logItem)));
Task.WaitAll(tasks.ToArray());
*/
#endregion
#region Non Parallel
logItemTask("byactivity", logItem);
logItemTask("bytime", logItem);
logItemTask("byip", logItem);
logItemTask("byuser", logItem);
#endregion
return true;
}
示例5: PushServiceTokenRepository
public PushServiceTokenRepository()
{
storage = CloudStorageAccount.Parse(RoleEnvironment.GetConfigurationSettingValue("StorageConnectionString"));
client = storage.CreateCloudTableClient();
client.CreateTableIfNotExist(TableName);
context = client.GetDataServiceContext();
}
示例6: Initialize
private static void Initialize()
{
if (_isStorageInitialized)
return;
lock(_initializeLock)
{
if (_isStorageInitialized)
return;
CloudStorageAccount.SetConfigurationSettingPublisher((setting, setter) =>
{
setter(RoleEnvironment.GetConfigurationSettingValue(setting));
});
var cloudStorageAccount = CloudStorageAccount.FromConfigurationSetting(StorageConstants.StorageConnectionsString);
_cloudQueueClient = cloudStorageAccount.CreateCloudQueueClient();
CloudQueue membershipsPumpQueue = _cloudQueueClient.GetQueueReference(StorageConstants.MembershipsPumpQueue);
membershipsPumpQueue.CreateIfNotExist();
CloudQueue testMembershipPumpQueue = _cloudQueueClient.GetQueueReference(StorageConstants.TestMembershipPumpQueue);
testMembershipPumpQueue.CreateIfNotExist();
CloudQueue testMembershipDeleterQueue = _cloudQueueClient.GetQueueReference(StorageConstants.TestMembershipDeleterQueue);
testMembershipDeleterQueue.CreateIfNotExist();
_cloudTableClient = cloudStorageAccount.CreateCloudTableClient();
_cloudTableClient.CreateTableIfNotExist(StorageConstants.TestTable);
_isStorageInitialized = true;
}
}
示例7: OnStart
public override bool OnStart()
{
// Set the maximum number of concurrent connections
ServicePointManager.DefaultConnectionLimit = 12;
#if DEBUG
account = CloudStorageAccount.DevelopmentStorageAccount;
#else
account = new CloudStorageAccount(accountAndKey, true);
#endif
tableContext = new TableServiceContext(account.TableEndpoint.ToString(), account.Credentials);
//client = new CloudQueueClient(account.BlobEndpoint.ToString(), account.Credentials);
qclient = account.CreateCloudQueueClient();
q = qclient.GetQueueReference("icd9mapplotrequests");
rows = new List<ICD9MapPlotResultEntry>();
bclient = account.CreateCloudBlobClient();
container = bclient.GetContainerReference("results");
container.CreateIfNotExist();
client = account.CreateCloudTableClient();
client.CreateTableIfNotExist("ICD9MapPlotResult");
client.CreateTableIfNotExist("DoctorDetails");
client.CreateTableIfNotExist("PatientDetails");
// For information on handling configuration changes
// see the MSDN topic at http://go.microsoft.com/fwlink/?LinkId=166357.
return base.OnStart();
}
示例8: GetCloudTableClient
/// <summary>
/// Returns cloud table storage client
/// </summary>
/// <returns></returns>
public void GetCloudTableClient()
{
if (tableClient == null)
new TableStorageHelper();
tableClient = storageAccount.CreateCloudTableClient();
}
示例9: PlayerRepository
public PlayerRepository(Microsoft.WindowsAzure.StorageClient.CloudTableClient client)
{
_client = client;
_client.CreateTableIfNotExist(_table_name);
_client.CreateTableIfNotExist(_facebook_player_table_name);
_client.CreateTableIfNotExist(_player_password_table_name);
}
示例10: AzureEventStore
public AzureEventStore(CloudStorageAccount storageAccount)
{
_account = storageAccount;
_tableClient = _account.CreateCloudTableClient();
InitializeStorage();
}
示例11: AddAilmentDetails
//ADD AILMENT DETAILS
public void AddAilmentDetails(AilmentDetails AilData)
{
#if DEBUG
account = CloudStorageAccount.DevelopmentStorageAccount;
#else
account = new CloudStorageAccount(accountAndKey, true);
#endif
client = account.CreateCloudTableClient();
client.CreateTableIfNotExist("PatientDetails");
tableContext = new TableServiceContext(account.TableEndpoint.ToString(), account.Credentials);
AilmentDetails x = new AilmentDetails();
x.AttendingPhysician = AilData.AttendingPhysician;
x.Diagnosis = AilData.Diagnosis;
x.DiagnosisID = AilData.DiagnosisID;
x.GeneralPhysician = AilData.GeneralPhysician;
x.Hospital = AilData.Hospital;
x.Lab_Pathology = AilData.Lab_Pathology;
x.Lab_Physical = AilData.Lab_Physical;
x.Lab_Radiology = AilData.Lab_Physical;
x.Medication = AilData.Medication;
x.PatientIDLinkRowKey = AilData.PatientIDLinkRowKey;
x.ProgressNotes = AilData.ProgressNotes;
x.Symptoms = AilData.Symptoms;
x.TimeIn = AilData.TimeIn;
x.TimeOut = AilData.TimeOut;
x.Treatment = AilData.Treatment;
x.AilmentDetailRowKey = AilData.AilmentDetailRowKey;
tableContext.AddObject("PatientDetails", x);
tableContext.SaveChanges();
}
示例12: PushServiceTokenRepository
public PushServiceTokenRepository()
{
storage = CloudStorageAccount.Parse(ConfigurationManager.AppSettings["StorageConnectionString"]);
client = storage.CreateCloudTableClient();
client.CreateTableIfNotExist(TableName);
context = new TableServiceContextV2(client.BaseUri.ToString(), client.Credentials);
}
示例13: EventStore
public EventStore(CloudStorageAccount account, string tableName)
{
if (account == null) throw new ArgumentNullException("account");
if (tableName == null) throw new ArgumentNullException("tableName");
if (string.IsNullOrWhiteSpace(tableName)) throw new ArgumentException("tableName");
this.account = account;
this.tableName = tableName;
this.tableClient = account.CreateCloudTableClient();
this.tableClient.RetryPolicy = RetryPolicies.NoRetry();
// TODO: This could be injected.
var backgroundRetryStrategy = new ExponentialBackoff(10, TimeSpan.FromMilliseconds(100), TimeSpan.FromSeconds(15), TimeSpan.FromSeconds(1));
var blockingRetryStrategy = new Incremental(3, TimeSpan.FromMilliseconds(100), TimeSpan.FromSeconds(1));
this.pendingEventsQueueRetryPolicy = new RetryPolicy<StorageTransientErrorDetectionStrategy>(backgroundRetryStrategy);
this.pendingEventsQueueRetryPolicy.Retrying += (s, e) =>
{
var handler = this.Retrying;
if (handler != null)
{
handler(this, EventArgs.Empty);
}
Trace.TraceWarning("An error occurred in attempt number {1} to access table storage (PendingEventsQueue): {0}", e.LastException.Message, e.CurrentRetryCount);
};
this.eventStoreRetryPolicy = new RetryPolicy<StorageTransientErrorDetectionStrategy>(blockingRetryStrategy);
this.eventStoreRetryPolicy.Retrying += (s, e) => Trace.TraceWarning(
"An error occurred in attempt number {1} to access table storage (EventStore): {0}",
e.LastException.Message,
e.CurrentRetryCount);
this.eventStoreRetryPolicy.ExecuteAction(() => tableClient.CreateTableIfNotExist(tableName));
}
示例14: AzureCommandLogReader
public AzureCommandLogReader(CloudStorageAccount account, string tableName, ITextSerializer serializer) :
base(account, tableName, serializer)
{
this.tableName = tableName;
this.serializer = serializer;
this.tableClient = account.CreateCloudTableClient();
}
示例15: FriendshipRepository
public FriendshipRepository()
{
storage = CloudStorageAccount.Parse(ConfigurationManager.AppSettings["StorageConnectionString"]);
client = storage.CreateCloudTableClient();
client.CreateTableIfNotExist(TableName);
context = client.GetDataServiceContext();
}