本文整理汇总了C#中Microsoft.WindowsAzure.Storage.Table.CloudTableClient类的典型用法代码示例。如果您正苦于以下问题:C# CloudTableClient类的具体用法?C# CloudTableClient怎么用?C# CloudTableClient使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CloudTableClient类属于Microsoft.WindowsAzure.Storage.Table命名空间,在下文中一共展示了CloudTableClient类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Tracker
public Tracker(string accountName, string keyValue)
{
_applicationId = IdUtil.ApplicationId();
_deviceId = IdUtil.DeviceId();
_anid = IdUtil.GetAnidFromOs();
_appTitle = IdUtil.ApplicationName();
_adsRefreshRate = 3;
_pubCenterAdsId = new List<string>();
_adsReady = false;
// Due to Disallowed key in RowKey, /, \, #, ? needs to be removed
// And excel cannot allow "=" at the beginning
foreach (var s in _invalidRowKeyChar) {
_deviceId = _deviceId.Replace(s, string.Empty);
if (_deviceId.Substring(0, 1) == "=") {
_deviceId = "x" + _deviceId;
}
}
GetAdAssemblyVersion();
RefreshIpInfo();
_storageCredentials = new StorageCredentials(accountName, keyValue);
_storageAccount = new CloudStorageAccount(_storageCredentials, false);
_tableClient = _storageAccount.CreateCloudTableClient();
EnsureTablesCreated();
}
示例2: TestCacheStats
public TestCacheStats(TestResultStorage testResultStorage, CloudTableClient tableClient)
{
_testResultStorage = testResultStorage;
_unitTestCounterUtil = new CounterUtil<UnitTestCounterEntity>(tableClient.GetTableReference(AzureConstants.TableNames.CounterUnitTestQuery));
_testCacheCounterUtil = new CounterUtil<TestCacheCounterEntity>(tableClient.GetTableReference(AzureConstants.TableNames.CounterTestCache));
_testRunCounterUtil = new CounterUtil<TestRunCounterEntity>(tableClient.GetTableReference(AzureConstants.TableNames.CounterTestRun));
}
示例3: QueryImpl
private static RESTCommand<TableQuerySegment> QueryImpl(TableQuery query, TableContinuationToken token, CloudTableClient client, string tableName, TableRequestOptions requestOptions)
{
UriQueryBuilder builder = query.GenerateQueryBuilder();
if (token != null)
{
token.ApplyToUriQueryBuilder(builder);
}
StorageUri tempUriList = NavigationHelper.AppendPathToUri(client.StorageUri, tableName);
RESTCommand<TableQuerySegment> queryCmd = new RESTCommand<TableQuerySegment>(client.Credentials, tempUriList);
requestOptions.ApplyToStorageCommand(queryCmd);
queryCmd.CommandLocationMode = CommonUtility.GetListingLocationMode(token);
queryCmd.RetrieveResponseStream = true;
queryCmd.Handler = client.AuthenticationHandler;
queryCmd.BuildClient = HttpClientFactory.BuildHttpClient;
queryCmd.Builder = builder;
queryCmd.BuildRequest = (cmd, uri, queryBuilder, cnt, serverTimeout, ctx) => TableOperationHttpRequestMessageFactory.BuildRequestForTableQuery(uri, builder, serverTimeout, cnt, ctx);
queryCmd.PreProcessResponse = (cmd, resp, ex, ctx) => HttpResponseParsers.ProcessExpectedStatusCodeNoException(HttpStatusCode.OK, resp.StatusCode, null /* retVal */, cmd, ex);
queryCmd.PostProcessResponse = async (cmd, resp, ctx) =>
{
TableQuerySegment resSeg = await TableOperationHttpResponseParsers.TableQueryPostProcess(cmd.ResponseStream, resp, ctx);
if (resSeg.ContinuationToken != null)
{
resSeg.ContinuationToken.TargetLocation = cmd.CurrentResult.TargetLocation;
}
return resSeg;
};
return queryCmd;
}
示例4: CleanupTable
private void CleanupTable(string tableName)
{
var account = CloudStorageAccount.DevelopmentStorageAccount;
var cloudTableClient = new CloudTableClient(account.TableEndpoint, account.Credentials);
var table = cloudTableClient.GetTableReference(tableName);
table.DeleteIfExists();
}
示例5: AzureTableStorageStatusTraceListener
public AzureTableStorageStatusTraceListener(String initializeData) : base(initializeData)
{
string connectionString = null;
string tableName = "status";
if (initializeData != null)
{
foreach (String keyValuePair in initializeData.Split(','))
{
String[] parts = keyValuePair.Split('*');
if (parts.Length == 2)
{
if (parts[0].Equals("tablestorage", StringComparison.InvariantCultureIgnoreCase))
{
connectionString = parts[1].Trim();
}
else if (parts[0].Equals("table", StringComparison.InvariantCultureIgnoreCase))
{
tableName = parts[1].Trim();
}
}
}
}
if (String.IsNullOrWhiteSpace(connectionString))
{
throw new ArgumentNullException("tablestorage", "The initializeData string must specify the Azure table storage connection string in the tablestorage field.");
}
this._storageAccount = CloudStorageAccount.Parse(connectionString);
this._tableClient = this._storageAccount.CreateCloudTableClient();
this._table = this._tableClient.GetTableReference(tableName);
this._table.CreateIfNotExists();
}
示例6: Init
private void Init()
{
Trace.TraceInformation("Starting initialization.");
Account = CloudStorageAccount.Parse(ConfigurationManager.AppSettings[Constants.ConfigurationSectionKey]);
TableClient = Account.CreateCloudTableClient();
Container = Account.CreateCloudBlobClient().GetContainerReference(Constants.ContainerName);
BlobContainerPermissions blobPermissions = new BlobContainerPermissions();
blobPermissions.SharedAccessPolicies.Add(ConfigurationManager.AppSettings["AccountId"], new SharedAccessBlobPolicy()
{
SharedAccessExpiryTime = DateTime.UtcNow.AddHours(10),
Permissions = SharedAccessBlobPermissions.Write |
SharedAccessBlobPermissions.Read
});
blobPermissions.PublicAccess = BlobContainerPublicAccessType.Off;
// Set the permission policy on the container.
Container.SetPermissions(blobPermissions);
SasToken = Container.GetSharedAccessSignature(new SharedAccessBlobPolicy(), ConfigurationManager.AppSettings["AccountId"]);
BlobBaseUri = Account.BlobEndpoint;
Trace.TraceInformation("Initialization finished.");
}
示例7: TProduct
public TProduct(string affiliate, string code, int qty, bool force_lookup = false)
{
ProductCode = code;
Qty = qty;
cloud = CloudStorageAccount.Parse(CloudConfigurationManager.GetSetting("AbundaStorage"));
client = cloud.CreateCloudTableClient();
products = client.GetTableReference("Products");
products.CreateIfNotExists();
using (var context = new DataBaseDataContext())
{
var aff = (from ev in context.Affiliates
where ev.code == affiliate
select ev).FirstOrDefault();
merchantID = aff.MerchantID;
marketplaceID = aff.MarketPlaceID;
secretKey = aff.SecretKey;
accessKey = aff.AccessKey;
}
var amzResults = PerformAmazonLookup();
}
示例8: HomeController
public HomeController()
{
storageAccount = CloudStorageAccount.Parse(
ConfigurationManager.AppSettings["StorageConnectionString"]);
tableClient = storageAccount.CreateCloudTableClient();
table = tableClient.GetTableReference("fouramigos");
table.CreateIfNotExists();
blobClient = storageAccount.CreateCloudBlobClient();
container = blobClient.GetContainerReference("fouramigos");
container.CreateIfNotExists();
BlobContainerPermissions permissions = container.GetPermissions();
permissions.PublicAccess = BlobContainerPublicAccessType.Container;
container.SetPermissions(permissions);
//lägga till nya
//var tablemodels = new TableModel("Brutus", "Uggla") { Location = "T4", Description="Uggla i träd", Type="Foto" };
//var tablemodels1 = new TableModel("brutus", "Örn") { Location = "T4", Description="Örn som flyger", Type = "Foto" };
//var opreation = TableOperation.Insert(tablemodels);
//var operation2 = TableOperation.Insert(tablemodels1);
//table.Execute(opreation);
//table.Execute(operation2);
}
示例9: CloudCoreStoredTable
protected CloudCoreStoredTable(string accountSonnectionString = "")
{
SetAccount(accountSonnectionString);
cloudTableClient = cloudStorageAccount.CreateCloudTableClient();
cloudTable = cloudTableClient.GetTableReference(GetType().Name.Replace("Entity", "").Replace("Table", "").ToLower());
cloudTable.CreateIfNotExists();
}
示例10: NDIAzureTableController
static NDIAzureTableController()
{
_storageAccount = CloudStorageAccount.Parse(CloudConfigurationManager.GetSetting("StorageConnectionString"));
_tableClient = _storageAccount.CreateCloudTableClient();
_table = _tableClient.GetTableReference("ndiparams");
_retrieveOperation = TableOperation.Retrieve("VidParams", "LastVideo");
}
示例11: BlobStorageManager
public BlobStorageManager(string blobConnectionEndPointString)
{
this.blobConnectionEndPointString = blobConnectionEndPointString;
CloudStorageAccount VP2ClientBlobStorageAccount = CloudStorageAccount.Parse(blobConnectionEndPointString);
VP2CloudBlobClient = VP2ClientBlobStorageAccount.CreateCloudBlobClient();
VP2CloudTableClient = VP2ClientBlobStorageAccount.CreateCloudTableClient();
}
示例12: GetCloudTableClient
private CloudTableClient GetCloudTableClient(string sasUrl)
{
int parseIndex = sasUrl.IndexOf('?');
if (parseIndex > 0)
{
string tableAddress = sasUrl.Substring(0, parseIndex);
int tableParseIndex = tableAddress.LastIndexOf('/');
if (tableParseIndex > 0)
{
tableName = tableAddress.Substring(tableParseIndex + 1);
string endpointAddress = tableAddress.Substring(0, tableParseIndex);
string sasSignature = sasUrl.Substring(parseIndex);
var tableClient = new CloudTableClient(new Uri(endpointAddress), new StorageCredentials(sasSignature));
// This is a hack for the Azure Storage SDK to make it work with version 2012 SAS urls as long as we support them.
// Apply hack only if the SAS url is version 2012.
if (sasSignature.IndexOf("sv=2012-02-12", StringComparison.OrdinalIgnoreCase) >= 0)
{
tableClient.DefaultRequestOptions.PayloadFormat = TablePayloadFormat.AtomPub;
var type = typeof(TableConstants);
var field = type.GetField("ODataProtocolVersion", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Static);
field.SetValue(null, ODataVersion.V2);
}
return tableClient;
}
}
return null;
}
示例13: StorageTableAccessor
public StorageTableAccessor(CloudStorageAccount storageAccount)
{
CloudTableClient tableClient = new CloudTableClient(storageAccount.TableStorageUri, storageAccount.Credentials);
this.table = tableClient.GetTableReference(messageTableName);
this.table.CreateIfNotExists();
ReadFirstEntry();
}
示例14: CreateCustomerMetadata
static void CreateCustomerMetadata(CloudTableClient tableClient)
{
Console.WriteLine("Creating customers metadata...");
CloudTable customersMetadataTable = tableClient.GetTableReference("customersmetadata");
customersMetadataTable.CreateIfNotExists();
var msftAddress1 = new DictionaryTableEntity();
msftAddress1.PartitionKey = "MSFT";
msftAddress1.RowKey = "ADDRESS-" + Guid.NewGuid().ToString("N").ToUpper();
msftAddress1.Add("city", "Seattle");
msftAddress1.Add("street", "111 South Jackson");
var msftWebsite1 = new DictionaryTableEntity();
msftWebsite1.PartitionKey = "MSFT";
msftWebsite1.RowKey = "WEBSITE-" + Guid.NewGuid().ToString("N").ToUpper();
msftWebsite1.Add("url", "http://www.microsoft.com");
var msftWebsite2 = new DictionaryTableEntity();
msftWebsite2.PartitionKey = "MSFT";
msftWebsite2.RowKey = "WEBSITE-" + Guid.NewGuid().ToString("N").ToUpper();
msftWebsite2.Add("url", "http://www.windowsazure.com");
var batch = new TableBatchOperation();
batch.Add(TableOperation.Insert(msftAddress1));
batch.Add(TableOperation.Insert(msftWebsite1));
batch.Add(TableOperation.Insert(msftWebsite2));
customersMetadataTable.ExecuteBatch(batch);
Console.WriteLine("Done. Press ENTER to read the customer metadata.");
Console.ReadLine();
}
示例15: GenerateCloudTableClient
public static CloudTableClient GenerateCloudTableClient()
{
Uri baseAddressUri = new Uri(TestBase.TargetTenantConfig.TableServiceEndpoint);
CloudTableClient client = new CloudTableClient(baseAddressUri, TestBase.StorageCredentials);
client.AuthenticationScheme = DefaultAuthenticationScheme;
return client;
}