本文整理汇总了C#中Microsoft.WindowsAzure.StorageClient.CloudTableClient.CreateTableIfNotExist方法的典型用法代码示例。如果您正苦于以下问题:C# CloudTableClient.CreateTableIfNotExist方法的具体用法?C# CloudTableClient.CreateTableIfNotExist怎么用?C# CloudTableClient.CreateTableIfNotExist使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.WindowsAzure.StorageClient.CloudTableClient
的用法示例。
在下文中一共展示了CloudTableClient.CreateTableIfNotExist方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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();
}
示例2: 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();
}
示例3: 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);
}
示例4: Context
static Context()
{
CloudStorageAccount.SetConfigurationSettingPublisher((configname, configsettingsPublisher) =>
{
var connectionString = RoleEnvironment.GetConfigurationSettingValue(configname);
configsettingsPublisher(connectionString);
});
account = CloudStorageAccount.FromConfigurationSetting("DataConnectionString");
CloudTableClient tableClient = new CloudTableClient(account.TableEndpoint.AbsoluteUri, account.Credentials);
tableClient.CreateTableIfNotExist(PLAYER);
tableClient.CreateTableIfNotExist(GAME);
//tableClient.DeleteTableIfExist(PLAYER);
//tableClient.DeleteTableIfExist(GAME);
}
示例5: 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;
}
}
示例6: 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();
}
示例7: PushServiceTokenRepository
public PushServiceTokenRepository()
{
storage = CloudStorageAccount.Parse(RoleEnvironment.GetConfigurationSettingValue("StorageConnectionString"));
client = storage.CreateCloudTableClient();
client.CreateTableIfNotExist(TableName);
context = new TableServiceContextV2(client.BaseUri.ToString(), client.Credentials);
}
示例8: PushServiceTokenRepository
public PushServiceTokenRepository()
{
storage = CloudStorageAccount.Parse(ConfigurationManager.AppSettings["StorageConnectionString"]);
client = storage.CreateCloudTableClient();
client.CreateTableIfNotExist(TableName);
context = new TableServiceContextV2(client.BaseUri.ToString(), client.Credentials);
}
示例9: 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;
}
}
示例10: FriendshipRepository
public FriendshipRepository()
{
storage = CloudStorageAccount.Parse(ConfigurationManager.AppSettings["StorageConnectionString"]);
client = storage.CreateCloudTableClient();
client.CreateTableIfNotExist(TableName);
context = client.GetDataServiceContext();
}
示例11: PersistPrimeSum
public PersistPrimeSum()
{
tableClient = storageAccount.CreateCloudTableClient();
tableClient.CreateTableIfNotExist(TheTableName);
tableServiceContext = tableClient.GetDataServiceContext();
tableServiceContext.IgnoreResourceNotFoundException = true;
}
开发者ID:sseyalioglu,项目名称:AzureWebAndWorker_For_PrimeSumFinder_withScale,代码行数:7,代码来源:PersistPrimeSum.cs
示例12: PushServiceTokenRepository
public PushServiceTokenRepository()
{
storage = CloudStorageAccount.Parse(RoleEnvironment.GetConfigurationSettingValue("StorageConnectionString"));
client = storage.CreateCloudTableClient();
client.CreateTableIfNotExist(TableName);
context = client.GetDataServiceContext();
}
示例13: AzureStorageClient
public AzureStorageClient()
{
CloudStorageAccount account = CloudStorageAccount.Parse(CloudConfigurationManager.GetSetting("StorageConnectionString"));
mTableClient = account.CreateCloudTableClient();
mTableClient.CreateTableIfNotExist(TranslationTable);
mContext = mTableClient.GetDataServiceContext();
mContext.IgnoreResourceNotFoundException = true;
}
示例14: CustomerRepoDapper
public CustomerRepoDapper()
{
connStr = ConfigurationManager.ConnectionStrings["DMTPrimary"].ConnectionString;
storage = CloudStorageAccount.Parse(ConfigurationManager.AppSettings["StorageConnectionString"]);
client = storage.CreateCloudTableClient();
client.CreateTableIfNotExist(TableName);
context = new TableServiceContextV2(client.BaseUri.ToString(), client.Credentials);
}
示例15: MessageBoardDataSource
//The default constructor initializes the storage account by reading its settings from
//the configuration and then uses CreateTableIfNotExist method in the CloudTableClient
//class to create the table used by the application.
public MessageBoardDataSource()
{
string connectionString = RoleEnvironment.GetConfigurationSettingValue(connectionStringName);
storageAccount = CloudStorageAccount.Parse(connectionString);
tableClient = new CloudTableClient(storageAccount.TableEndpoint.AbsoluteUri, storageAccount.Credentials);
tableClient.RetryPolicy = RetryPolicies.Retry(3, TimeSpan.FromSeconds(1));
tableClient.CreateTableIfNotExist(messageTableName);
}