• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Table.CloudTable类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Microsoft.WindowsAzure.Storage.Table.CloudTable的典型用法代码示例。如果您正苦于以下问题:C# CloudTable类的具体用法?C# CloudTable怎么用?C# CloudTable使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



CloudTable类属于Microsoft.WindowsAzure.Storage.Table命名空间,在下文中一共展示了CloudTable类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Crawler

        public Crawler()
        {
            CloudStorageAccount storageAccount = CloudStorageAccount.Parse(ConfigurationManager.AppSettings["StorageConnectionString"]);
            CloudTableClient tableClient = storageAccount.CreateCloudTableClient();
            table = tableClient.GetTableReference("crawlertable");
            table.CreateIfNotExists();
            datatable = tableClient.GetTableReference("datatable");
            datatable.CreateIfNotExists();

            CloudQueueClient queueClient = storageAccount.CreateCloudQueueClient();
            urlQueue = queueClient.GetQueueReference("urlqueue");
            urlQueue.CreateIfNotExists();
            adminQueue = queueClient.GetQueueReference("adminqueue");
            adminQueue.CreateIfNotExists();

            alreadyVisitedUrls = new HashSet<String>();
            disallowedUrls = new HashSet<String>();
            errorUrls = new HashSet<String>();

            tableSize = 0;
            totalUrls = 0;
            counter = 1;

            compareDate = DateTime.ParseExact("2015-04-01", "yyyy-MM-dd", CultureInfo.InvariantCulture);

            //Regex to check for valid html document
            rgx = new Regex(@"^[a-zA-Z0-9\-]+.?(htm|html)?$");
        }
开发者ID:kinderst,项目名称:Web-Service-Like-Google,代码行数:28,代码来源:Crawler.cs


示例2: RegistrationKeyStorage

 public RegistrationKeyStorage(string connectionString)
 {
     var account = CloudStorageAccount.Parse(connectionString);
     var tableClient = account.CreateCloudTableClient();
     _registrationKeysTable = tableClient.GetTableReference("RegistrationKeys");
     _registrationKeysTable.CreateIfNotExists();
 }
开发者ID:Jiycefer,项目名称:IoTHub.DeviceManagement,代码行数:7,代码来源:RegistrationKeyStorage.cs


示例3: StatusController

 public StatusController()
 {
     var storage = ControllerUtil.CreateStorageAccount();
     _testResultStorage = new TestResultStorage(storage);
     _testCacheStats = new TestCacheStats(_testResultStorage, storage.CreateCloudTableClient());
     _testRunTable = storage.CreateCloudTableClient().GetTableReference(AzureConstants.TableNames.TestRunData);
 }
开发者ID:jaredpar,项目名称:jenkins,代码行数:7,代码来源:StatusController.cs


示例4: Initialize

 protected override void Initialize(HttpControllerContext controllerContext)
 {
     base.Initialize(controllerContext);
     storageAccount = CloudStorageAccount.Parse("UseDevelopmentStorage=true");
     var tableClient = storageAccount.CreateCloudTableClient();
     table = tableClient.GetTableReference("people");
 }
开发者ID:cmpcdaly,项目名称:table-storage-web-api-cache,代码行数:7,代码来源:PersonController.cs


示例5: OnStart

        public override bool OnStart()
        {
            ServicePointManager.DefaultConnectionLimit = Environment.ProcessorCount;

            // Read storage account configuration settings
            ConfigureDiagnostics();
            Trace.TraceInformation("Initializing storage account in worker role B");
            var storageAccount = Microsoft.WindowsAzure.Storage.CloudStorageAccount.Parse(RoleEnvironment.GetConfigurationSettingValue("StorageConnectionString"));

            // Initialize queue storage
            Trace.TraceInformation("Creating queue client.");
            CloudQueueClient queueClient = storageAccount.CreateCloudQueueClient();
            sendEmailQueue = queueClient.GetQueueReference("azuremailqueue");
            subscribeQueue = queueClient.GetQueueReference("azuremailsubscribequeue");

            // Initialize blob storage
            CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient();
            blobContainer = blobClient.GetContainerReference("azuremailblobcontainer");

            // Initialize table storage
            var tableClient = storageAccount.CreateCloudTableClient();
            mailingListTable = tableClient.GetTableReference("mailinglist");
            messageTable = tableClient.GetTableReference("message");
            messagearchiveTable = tableClient.GetTableReference("messagearchive");

            Trace.TraceInformation("WorkerB: Creating blob container, queue, tables, if they don't exist.");
            blobContainer.CreateIfNotExists();
            sendEmailQueue.CreateIfNotExists();
            subscribeQueue.CreateIfNotExists();
            this.messageTable.CreateIfNotExists();
            this.mailingListTable.CreateIfNotExists();
            this.messagearchiveTable.CreateIfNotExists();

            return base.OnStart();
        }
开发者ID:phongha,项目名称:myprojects,代码行数:35,代码来源:WorkerRoleB.cs


示例6: InitForInsert

        //*******************
        //*                 *
        //*  InitForInsert  *
        //*                 *
        //*******************
        // Initialize dialog for inserting new records.
        
        public void InitForInsert(CloudTable table, Dictionary<String, bool> tableColumnNames)
        {
            this.IsAddNew = true;
            this.Table = table;
            this.Title = "Insert New Entity";
            this.CmdInsertUpdateEntity.Content = new TextBlock() { Text = "Insert Entity" };
            this.Heading.Text = "Enter fields and values for a new entity.";

            if (tableColumnNames != null)
            {
                foreach (KeyValuePair<String, bool> col in tableColumnNames)
                {
                    switch(col.Key)
                    {
                        case "PartitionKey":
                        case "RowKey":
                        case "Timestamp":
                            break;
                        default:
                            AddFieldRow(col.Key, "String", String.Empty);
                            break;
                    }
                }
            }
        }
开发者ID:fhurta,项目名称:AzureStorageExplorer,代码行数:32,代码来源:EditEntityDialog.xaml.cs


示例7: Run

        public IEnumerable<CommandResult> Run(CloudTable table, int numberOfProcess, int parallelism = 0)
        {
            if (parallelism == 0) parallelism = System.Environment.ProcessorCount * 3;

            if(parallelism == 1)
                return Run(table, new Tuple<int, int>(0, numberOfProcess));

            var sizeOfWorkload = numberOfProcess / parallelism + (numberOfProcess % parallelism == 0 ? 0 : 1);

            var chunker = Partitioner.Create(0, numberOfProcess, sizeOfWorkload);

            var results = new ConcurrentQueue<IList<CommandResult>>();

            // Loop over the workload partitions in parallel.
            Parallel.ForEach(chunker,
                new ParallelOptions { MaxDegreeOfParallelism = parallelism },
                (range) => results.Enqueue(Run(table, range))
                );

            var ret = new List<CommandResult>();

            foreach (var l in results) ret.AddRange(l);

            return ret;
#if BUG
            return results.Aggregate<IEnumerable<CommandResult>>((f, s) =>
            {
                return f.Concat(s).AsEnumerable();
            });
#endif
        }
开发者ID:takekazuomi,项目名称:WAAC201202,代码行数:31,代码来源:InsertBatch.cs


示例8: BatchInsertTests

 public BatchInsertTests()
 {
     var account = Util.GetStorageAccount();
     var client = account.CreateCloudTableClient();
     _table = client.GetTableReference("BatchOperationTests");
     _table.CreateIfNotExists();
 }
开发者ID:jaredpar,项目名称:jenkins,代码行数:7,代码来源:AzureUtilTests.cs


示例9: ConcurrencyConflictException

 internal ConcurrencyConflictException(CloudTable table, Partition partition, string details)
     : base("Concurrent write detected for partition '{1}' which resides in table '{0}' located at {2}. See details below.\n{3}",
            table, partition, table.StorageUri, details)
 {
     Table = table;
     Partition = partition;
 }
开发者ID:gabikliot,项目名称:Streamstone,代码行数:7,代码来源:Exceptions.cs


示例10: DoInsert

        async Task<CommandResult> DoInsert(CloudTable table, long n, Func<long, EntityNk[]> entityFactory)
        {
            
            var batchOperation = new TableBatchOperation();

            foreach (var e in entityFactory(n))
            {
                batchOperation.Insert(e);
            }

            var cresult = new CommandResult { Start = DateTime.UtcNow.Ticks };
            var cbt = 0L;
            var context = GetOperationContext((t) => cbt = t);
            try
            {
                var results = await table.ExecuteBatchAsync(batchOperation, operationContext: context);
                cresult.Elapsed = cbt;
            }
            catch (Exception ex)
            {
                cresult.Elapsed = -1;
                Console.Error.WriteLine("Error DoInsert {0} {1}", n, ex.ToString());
            }
            return cresult;
        }
开发者ID:takekazuomi,项目名称:WAAC201202,代码行数:25,代码来源:InsertBatch.cs


示例11: Main

        public static void Main()
        {
     //       string connectionString =
     //ConfigurationManager.ConnectionStrings["RootManageSharedAccessKey"].ConnectionString;
     //       Action<BrokeredMessage> callback = x =>
     //       {
                
     //       };
     //       var clients = new List<SubscriptionClient>();
     //       for (int i = 0; i < 5; i++)
     //       {
     //           var client = TopicClient.CreateFromConnectionString(connectionString, "signalr_topic_push_" + i);
     //           client.
     //           client.OnMessage(callback);
     //           clients.Add(client);
     //       }
     //       Console.ReadLine();
            //var ctx = GlobalHost.ConnectionManager.GetHubContext<yourhub>();
            //ctx.Clients.Client(connectionId).< your method >

            var cloudStorage = CloudStorageAccount.Parse(ConfigurationManager.ConnectionStrings["DataStorage"].ConnectionString);
            var tableClient = cloudStorage.CreateCloudTableClient();
            _tickEvents = tableClient.GetTableReference("tickevents");
            _tickEvents.CreateIfNotExists();
            var host = new JobHost();
            var cancelToken = new WebJobsShutdownWatcher().Token;
            _eventHubClient = EventHubClient.CreateFromConnectionString(ConfigurationManager.ConnectionStrings["IotHubConnection"].ConnectionString, iotHubD2cEndpoint);
            var d2CPartitions = _eventHubClient.GetRuntimeInformation().PartitionIds;
            Task.WaitAll(d2CPartitions.Select(partition => ListenForEvent(host, partition, cancelToken)).ToArray(), cancelToken);
            host.RunAndBlock();
        }
开发者ID:HouseOfTheFuture,项目名称:API-App,代码行数:31,代码来源:Program.cs


示例12: Batch

 public Batch(CloudTable table, List<TableEntity> entities, bool merge)
 {
     Entities = entities;
     Table = table;
     Merge = merge;
     TableBatchManager.LogInfo("Batch created");
 }
开发者ID:adhurwit,项目名称:AzureStorageTools,代码行数:7,代码来源:Batch.cs


示例13: RepositoryBase

 protected RepositoryBase(string table)
 {
     var storageAccount = Microsoft.WindowsAzure.Storage.CloudStorageAccount.Parse(RoleEnvironment.GetConfigurationSettingValue("StorageConnectionString"));
     var tableClient = storageAccount.CreateCloudTableClient();
     _table = tableClient.GetTableReference(table);
     _table.CreateIfNotExists();
 }
开发者ID:hjgraca,项目名称:azuretake,代码行数:7,代码来源:RepositoryBase.cs


示例14: VerificationLogger

 static VerificationLogger()
 {
     CloudStorageAccount storageAccount = CloudStorageAccount.DevelopmentStorageAccount;
     CloudTableClient tableClient = storageAccount.CreateCloudTableClient();
     table = tableClient.GetTableReference("MultiHostedEndpointsOutput");
     table.CreateIfNotExists();
 }
开发者ID:vanwyngardenk,项目名称:docs.particular.net,代码行数:7,代码来源:VerificationLogger.cs


示例15: CloudCoreStoredTable

 protected CloudCoreStoredTable(string accountSonnectionString = "")
 {
     SetAccount(accountSonnectionString);
     cloudTableClient = cloudStorageAccount.CreateCloudTableClient();
     cloudTable = cloudTableClient.GetTableReference(GetType().Name.Replace("Entity", "").Replace("Table", "").ToLower());
     cloudTable.CreateIfNotExists();
 }
开发者ID:Exclr8,项目名称:CloudCore,代码行数:7,代码来源:TableStorage.cs


示例16: OpenAsync

        public Task OpenAsync(PartitionContext context)
        {
            /*client = new HttpClient();
            client.DefaultRequestHeaders.Add("X-ZUMO-APPLICATION", APP_KEY_MOBILE_SERVICES);
            client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
            return Task.FromResult<object>(null);*/

            var storageAccount = CloudStorageAccount.Parse(CloudConfigurationManager.GetSetting("StorageConnectionString"));
            var tableClient = storageAccount.CreateCloudTableClient();
            sensorLogTable = tableClient.GetTableReference("SensorLog");
            //sensorLogTable = tableClient.GetTableReference("SensorLog" + context.Lease.PartitionId);

            // 閾値の取得
            if (thresholdTempWarning == null)
            {
                var sensorConfigTable = tableClient.GetTableReference("SensorConfig");
                var query = new TableQuery<SensorConfig>();
                var configData = sensorConfigTable.ExecuteQuery(query);
                foreach (SensorConfig config in configData)
                {
                    if (config.PartitionKey == "TemperatureWarning")
                    {
                        thresholdTempWarning = config.Threshold;
                        System.Console.WriteLine("ThresholdTempWarning: " + thresholdTempWarning);
                    }
                    else if (config.PartitionKey == "TemperatureDanger")
                    {
                        thresholdTempDanger = config.Threshold;
                        System.Console.WriteLine("ThresholdTempDanger: " + thresholdTempDanger);
                    }
                }
            }

            return sensorLogTable.CreateIfNotExistsAsync();
        }
开发者ID:kenjihiranabe,项目名称:IoT-Hackathon-Zubogani-2015,代码行数:35,代码来源:SensorEventProcessor.cs


示例17: 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);
        }
开发者ID:Quintoh,项目名称:Konstprojektet,代码行数:32,代码来源:HomeController.cs


示例18: AzureHttpLoggerRepository

        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="storageConnectionString">Storage account connection string</param>
        /// <param name="azureTablePrefix">The repository stores data in two tables called httprequestbycorrelationid and httprequestbydatedescending, if this parameter is not null and not whitespace then it is used as a prefix for those table names.</param>
        /// <param name="granularity">The level of granularity for data in the partition. On a low traffic site hourly or even daily can be useful, whereas busy sites minute or second are more useful.</param>
        public AzureHttpLoggerRepository(string storageConnectionString, string azureTablePrefix, LogByDateGranularityEnum granularity)
        {
            if (string.IsNullOrWhiteSpace(storageConnectionString)) throw new ArgumentNullException(nameof(storageConnectionString));
            if (azureTablePrefix == null)
            {
                azureTablePrefix = "";
            }
            CloudStorageAccount storageAccount = CloudStorageAccount.Parse(storageConnectionString);
            CloudTableClient client = storageAccount.CreateCloudTableClient();
            _byCorrelationIdTable = client.GetTableReference(string.Concat(azureTablePrefix, RequestByCorrelationIdTableName));
            _byDateTimeDescendingTable = client.GetTableReference(string.Concat(azureTablePrefix, RequestByDateTimeDescendingTableName));

            _byCorrelationIdTable.CreateIfNotExists();
            _byDateTimeDescendingTable.CreateIfNotExists();

            switch (granularity)
            {
                case LogByDateGranularityEnum.Hour:
                    _granularPartitionKeyFormat = "yyyy-MM-dd hh";
                    break;

                case LogByDateGranularityEnum.Day:
                    _granularPartitionKeyFormat = "yyyy-MM-dd";
                    break;

                case LogByDateGranularityEnum.Minute:
                    _granularPartitionKeyFormat = "yyyy-MM-dd hh:mm";
                    break;

                case LogByDateGranularityEnum.Second:
                    _granularPartitionKeyFormat = "yyyy-MM-dd hh:mm:ss";
                    break;
            }
        }
开发者ID:gorkar,项目名称:AccidentalFish.ApplicationSupport.Owin,代码行数:40,代码来源:AzureHttpLoggerRepository.cs


示例19: CreateTableClient

        private void CreateTableClient(IConfigurationProvider configurationProvider)
        {
            string accountConnectionString = configurationProvider.GetValue("StorageAccountConnectionString");
            string sasToken = configurationProvider.GetValue("StorageAccountSasToken");

            if (string.IsNullOrWhiteSpace(sasToken) && string.IsNullOrWhiteSpace(accountConnectionString))
            {
                throw new ConfigurationErrorsException(
                    "Configuration must specify either the storage account connection string ('StorageAccountConnectionString' parameter) or SAS token ('StorageAccountSasToken' paramteter)");
            }

            string storageTableName = configurationProvider.GetValue("StorageTableName");
            if (string.IsNullOrWhiteSpace(storageTableName))
            {
                throw new ConfigurationErrorsException("Configuration must specify the target storage name ('storageTableName' parameter)");
            }

            CloudStorageAccount storageAccount = string.IsNullOrWhiteSpace(sasToken)
                ? CloudStorageAccount.Parse(accountConnectionString)
                : new CloudStorageAccount(new StorageCredentials(sasToken), useHttps: true);
            this.cloudTable = storageAccount.CreateCloudTableClient().GetTableReference(storageTableName);

            try
            {
                this.cloudTable.CreateIfNotExists();
            }
            catch (Exception e)
            {
                this.ReportListenerProblem("Could not ensure that destination Azure storage table exists" + Environment.NewLine + e.ToString());
                throw;
            }
        }
开发者ID:TylerAngell,项目名称:service-fabric-dotnet-management-party-cluster,代码行数:32,代码来源:TableStorageEventListener.cs


示例20: StorageController

 public StorageController()
 {
     CloudStorageAccount storageAccount = CloudStorageAccount.Parse(CloudConfigurationManager.GetSetting("StorageConnectionString"));
     CloudTableClient tableClient = storageAccount.CreateCloudTableClient();
     this.table = tableClient.GetTableReference(StorageController.TableName);
     this.table.CreateIfNotExists();
 }
开发者ID:JustinBeckwith,项目名称:HashtagRedis,代码行数:7,代码来源:StorageController.cs



注:本文中的Microsoft.WindowsAzure.Storage.Table.CloudTable类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Table.CloudTableClient类代码示例发布时间:2022-05-26
下一篇:
C# Protocol.ServiceProperties类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap