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


C# CloudTable.CreateIfNotExists方法代碼示例

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


在下文中一共展示了CloudTable.CreateIfNotExists方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: 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

示例2: TProduct

        public TProduct(string affiliate, string code, int qty, bool force_lookup = false)
        {
            ProductCode = code;
            Qty = qty;

            cloud = CloudStorageAccount.Parse(CloudConfigurationManager.GetSetting("AbundaStorage"));

            client = cloud.CreateCloudTableClient();

            products = client.GetTableReference("Products");
            products.CreateIfNotExists();

            using (var context = new DataBaseDataContext())
            {
                var aff = (from ev in context.Affiliates
                           where ev.code == affiliate
                           select ev).FirstOrDefault();

                merchantID = aff.MerchantID;
                marketplaceID = aff.MarketPlaceID;
                secretKey = aff.SecretKey;
                accessKey = aff.AccessKey;
            }

            var amzResults = PerformAmazonLookup();
        }
開發者ID:WickedMonkeySoftware,項目名稱:AbundaAzure,代碼行數:26,代碼來源:TProduct.cs

示例3: BatchInsertTests

 public BatchInsertTests()
 {
     var account = Util.GetStorageAccount();
     var client = account.CreateCloudTableClient();
     _table = client.GetTableReference("BatchOperationTests");
     _table.CreateIfNotExists();
 }
開發者ID:jaredpar,項目名稱:jenkins,代碼行數:7,代碼來源:AzureUtilTests.cs

示例4: 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

示例5: Initialize

 public AzureTableStorageProjectionMetaDataRepository Initialize(string connectionString)
 {
     var client = GetTableClient(connectionString);
     _table = client.GetTableReference("ProjectionMetaData");
     _table.CreateIfNotExists();
     return this;
 }
開發者ID:MessageHandler,項目名稱:MessageHandler.SDK.EventSource,代碼行數:7,代碼來源:AzureTableStorageProjectionMetaDataRepository.cs

示例6: Initialize

 public AzureTableStorageEventSource Initialize(string connectionString)
 {
     var client = GetTableClient(connectionString);
     _table = client.GetTableReference("EventSource");
     _table.CreateIfNotExists();
     return this;
 }
開發者ID:MessageHandler,項目名稱:MessageHandler.SDK.EventSource,代碼行數:7,代碼來源:AzureTableStorageEventSource.cs

示例7: 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

示例8: OnStart

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

            ConfigureDiagnostics();

            // Read storage account configuration settings
            Trace.TraceInformation("Initializing storage account in WorkerC");
            var storageAccount = CloudStorageAccount.Parse(RoleEnvironment.GetConfigurationSettingValue(
                "StorageConnectionString"
                ));

            // Initialize queue storage
            Trace.TraceInformation("Creating queue client in WorkerC");
            var queueClient = storageAccount.CreateCloudQueueClient();
            subscribeQueue = queueClient.GetQueueReference("subscribequeue");

            // Initialize table storage
            Trace.TraceInformation("Creating table client in WorkerC");
            var tableClient = storageAccount.CreateCloudTableClient();
            subscribersTable = tableClient.GetTableReference("Subscribers");

            Trace.TraceInformation("WorkerC: Creating blob container, queue, tables, if they don't exist.");
            subscribeQueue.CreateIfNotExists();
            subscribersTable.CreateIfNotExists();

            return base.OnStart();
        }
開發者ID:bwrichte,項目名稱:LoggingService,代碼行數:28,代碼來源:WorkerRoleC.cs

示例9: LogSaver

 public LogSaver(string connectionString)
 {
     var account = CloudStorageAccount.Parse(connectionString);
     var client = account.CreateCloudTableClient();
     _table = client.GetTableReference(TableName);
     _table.CreateIfNotExists();
 }
開發者ID:charlesLin,項目名稱:ApacheLogParser,代碼行數:7,代碼來源:LogSaver.cs

示例10: 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

示例11: 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

示例12: 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

示例13: 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

示例14: TableDal

 public TableDal(string storageConnectionString, string tableName)
 {
     var storageAccount = CloudStorageAccount.Parse(storageConnectionString);
     var tableClient = storageAccount.CreateCloudTableClient();
     _table = tableClient.GetTableReference(tableName);
     _table.CreateIfNotExists();
 }
開發者ID:wstcilzm,項目名稱:CAT_ITALite,代碼行數:7,代碼來源:TableDal.cs

示例15: 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


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