當前位置: 首頁>>代碼示例>>C#>>正文


C# CloudTableClient.CreateTableIfNotExist方法代碼示例

本文整理匯總了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();
        }
開發者ID:cloudscrubs,項目名稱:azureprototype,代碼行數:28,代碼來源:WorkerRole.cs

示例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();
        }
開發者ID:scottdensmore,項目名稱:AzureMultiEntitySchema,代碼行數:29,代碼來源:ApplicationStorageInitializer.cs

示例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);
 }
開發者ID:mustafashabib,項目名稱:verbosity-ios,代碼行數:7,代碼來源:PlayerRepository.cs

示例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);
 }
開發者ID:SamirHafez,項目名稱:Bantu,代碼行數:14,代碼來源:Context.cs

示例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;
            }
        }
開發者ID:zealoussnow,項目名稱:OneCode,代碼行數:34,代碼來源:Global.asax.cs

示例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();
        }
開發者ID:cloudscrubs,項目名稱:azureprototype,代碼行數:33,代碼來源:Service1.svc.cs

示例7: PushServiceTokenRepository

 public PushServiceTokenRepository()
 {
     storage = CloudStorageAccount.Parse(RoleEnvironment.GetConfigurationSettingValue("StorageConnectionString"));
     client = storage.CreateCloudTableClient();
     client.CreateTableIfNotExist(TableName);
     context = new TableServiceContextV2(client.BaseUri.ToString(), client.Credentials);
 }
開發者ID:mchambers,項目名稱:Daremeto,代碼行數:7,代碼來源:PushServiceTokenRepository.cs

示例8: PushServiceTokenRepository

 public PushServiceTokenRepository()
 {
     storage = CloudStorageAccount.Parse(ConfigurationManager.AppSettings["StorageConnectionString"]);
     client = storage.CreateCloudTableClient();
     client.CreateTableIfNotExist(TableName);
     context = new TableServiceContextV2(client.BaseUri.ToString(), client.Credentials);
 }
開發者ID:mchambers,項目名稱:howmuchto-service,代碼行數:7,代碼來源:PushServiceTokenRepository.cs

示例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;
            }
        }
開發者ID:secondcore,項目名稱:yesr-backend,代碼行數:33,代碼來源:StorageService.cs

示例10: FriendshipRepository

 public FriendshipRepository()
 {
     storage = CloudStorageAccount.Parse(ConfigurationManager.AppSettings["StorageConnectionString"]);
     client = storage.CreateCloudTableClient();
     client.CreateTableIfNotExist(TableName);
     context = client.GetDataServiceContext();
 }
開發者ID:mchambers,項目名稱:howmuchto-service,代碼行數:7,代碼來源:FriendshipRepository.cs

示例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();
 }
開發者ID:mchambers,項目名稱:Daremeto,代碼行數:7,代碼來源:PushServiceTokenRepository.cs

示例13: AzureStorageClient

 public AzureStorageClient()
 {
     CloudStorageAccount account = CloudStorageAccount.Parse(CloudConfigurationManager.GetSetting("StorageConnectionString"));
     mTableClient = account.CreateCloudTableClient();
     mTableClient.CreateTableIfNotExist(TranslationTable);
     mContext = mTableClient.GetDataServiceContext();
     mContext.IgnoreResourceNotFoundException = true;
 }
開發者ID:cchitsiang,項目名稱:Multi-Lingual-Chat,代碼行數:8,代碼來源:AzureStorageClient.cs

示例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);
        }
開發者ID:mchambers,項目名稱:howmuchto-service,代碼行數:9,代碼來源:CustomerRepoDapper.cs

示例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);
        }
開發者ID:balaTest,項目名稱:CloudSamples,代碼行數:12,代碼來源:MessageBoardDataSource.cs


注:本文中的Microsoft.WindowsAzure.StorageClient.CloudTableClient.CreateTableIfNotExist方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。