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


C# Table.CloudTable類代碼示例

本文整理匯總了C#中Microsoft.WindowsAzure.Storage.Table.CloudTable的典型用法代碼示例。如果您正苦於以下問題:C# CloudTable類的具體用法?C# CloudTable怎麽用?C# CloudTable使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


CloudTable類屬於Microsoft.WindowsAzure.Storage.Table命名空間,在下文中一共展示了CloudTable類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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


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