当前位置: 首页>>代码示例>>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;未经允许,请勿转载。