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


C# CloudTableClient.GetDataServiceContext方法代碼示例

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


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

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

示例2: PersistPrimeSum

 public PersistPrimeSum()
 {
     tableClient = storageAccount.CreateCloudTableClient();
     tableClient.CreateTableIfNotExist(TheTableName);
     tableServiceContext = tableClient.GetDataServiceContext();
     tableServiceContext.IgnoreResourceNotFoundException = true;
 }
開發者ID:sseyalioglu,項目名稱:AzureWebAndWorker_For_PrimeSumFinder_withScale,代碼行數:7,代碼來源:PersistPrimeSum.cs

示例3: PushServiceTokenRepository

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

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

示例5: TableStorageSiteUrlRepository

        public TableStorageSiteUrlRepository()
        {
            _storageAccount = CloudStorageAccount.Parse(
                CloudConfigurationManager.GetSetting(_connectionStringName)
                );

            _tableClient = new CloudTableClient(_storageAccount.TableEndpoint.AbsoluteUri, _storageAccount.Credentials);
            _tableClient.RetryPolicy = RetryPolicies.Retry(3, TimeSpan.FromSeconds(1));
            _tableClient.CreateTableIfNotExist(_tableName);
            _tableContext = _tableClient.GetDataServiceContext();
        }
開發者ID:woloski,項目名稱:SiteMonitR,代碼行數:11,代碼來源:TableStorageSiteUrlRepository.cs

示例6: StorageWrapper

 public StorageWrapper()
 {
     _storageAccount = CloudStorageAccount.Parse(
         RoleEnvironment.GetConfigurationSettingValue(_connectionStringName)
         );
     _tableClient = new CloudTableClient(_storageAccount.TableEndpoint.AbsoluteUri,
         _storageAccount.Credentials);
     _tableClient.RetryPolicy = RetryPolicies.Retry(3, TimeSpan.FromSeconds(1));
     _tableClient.CreateTableIfNotExist(_tableName);
     _tableContext = _tableClient.GetDataServiceContext();
 }
開發者ID:AndyCross,項目名稱:CloudMonitR,代碼行數:11,代碼來源:StorageWrapper.cs

示例7: NotificationRepository

        public NotificationRepository()
        {
            // Retrieve storage account from connection-string
            storageAccount = CloudStorageAccount.Parse(Properties.Settings.Default.DataStorageConnectionString);

            // Create the table client
            tableClient = storageAccount.CreateCloudTableClient();
            tableClient.CreateTableIfNotExist(tableName);

            // Get the data service context
            context = tableClient.GetDataServiceContext();
        }
開發者ID:AppliedIS,項目名稱:AzureTicker,代碼行數:12,代碼來源:NotificationRepository.cs

示例8: NotificationRepository

        public NotificationRepository()
        {
            // Retrieve storage account from connection-string
            storageAccount = CloudStorageAccount.Parse(
                CloudConfigurationManager.GetSetting(Constants.DataStorageConnectionStringKey));

            // Create the table client
            tableClient = storageAccount.CreateCloudTableClient();
            tableClient.CreateTableIfNotExist(tableName);

            // Get the data service context
            context = tableClient.GetDataServiceContext();
        }
開發者ID:AppliedIS,項目名稱:AzureTicker,代碼行數:13,代碼來源:NotificationRepository.cs

示例9: AzureStorageOld

        public AzureStorageOld(string account, string key, string table, bool nagling = true)
        {
            this._account = this.GetStorageAccount(account, key);

            EnableNagling(nagling);
            this._client = _account.CreateCloudTableClient();

            this._table = table;

            this.CreateTable(table);

            this._context = _client.GetDataServiceContext();
        }
開發者ID:WorldWayno,項目名稱:AzureStorageTests,代碼行數:13,代碼來源:AzureStorageOld.cs

示例10: DatabaseManager

        private DatabaseManager()
        {
            // Retrieve the storage account from the connection string
            storageAccount = CloudStorageAccount.Parse(CloudConfigurationManager.GetSetting("StorageConnectionString"));

            // Create the table client
            tableClient = storageAccount.CreateCloudTableClient();

            // Create the table if it doesn't exist
            tableClient.CreateTableIfNotExist(tableName);

            // Get the data service context
            serviceContext = tableClient.GetDataServiceContext();
        }
開發者ID:Japskua,項目名稱:QRAdventures,代碼行數:14,代碼來源:DatabaseManager.cs

示例11: QueryLogTable

        private static void QueryLogTable(CloudTableClient tableStorage)
        {
            TableServiceContext context = tableStorage.GetDataServiceContext();
            DataServiceQuery query = context.CreateQuery<LogEntry>(TableStorageTraceListener.DIAGNOSTICS_TABLE)
                                            .Where(entry => entry.PartitionKey.CompareTo(lastPartitionKey) > 0 
                                               || (entry.PartitionKey == lastPartitionKey && entry.RowKey.CompareTo(lastRowKey) > 0)) 
                                                as DataServiceQuery;

            foreach (AzureDiagnostics.LogEntry entry in query.Execute())
            {
                Console.WriteLine("{0} - {1}", entry.Timestamp, entry.Message);
                lastPartitionKey = entry.PartitionKey;
                lastRowKey = entry.RowKey;
            }
        }
開發者ID:Helen1987,項目名稱:edu,代碼行數:15,代碼來源:Program.cs

示例12: CreatePushNotificationTable

        private static void CreatePushNotificationTable(CloudTableClient cloudTableClient)
        {
            cloudTableClient.CreateTableIfNotExist(UserTablesServiceContext.PushUserTableName);

            // Execute conditionally for development storage only.
            if (cloudTableClient.BaseUri.IsLoopback)
            {
                var context = cloudTableClient.GetDataServiceContext();
                var entity = new PushUserEndpoint { UserId = "UserName", ChannelUri = "http://tempuri", TileCount = 0 };

                context.AddObject(UserTablesServiceContext.PushUserTableName, entity);
                context.SaveChangesWithRetries();
                context.DeleteObject(entity);
                context.SaveChangesWithRetries();
            }
        }
開發者ID:Setuber,項目名稱:Ringify,代碼行數:16,代碼來源:WebRole.cs

示例13: CreateUserPrivilegeTable

        private static void CreateUserPrivilegeTable(CloudTableClient cloudTableClient)
        {
            cloudTableClient.CreateTableIfNotExist(PrivilegesTableServiceContext.UserPrivilegeTableName);

            // Execute conditionally for development storage only.
            if (cloudTableClient.BaseUri.IsLoopback)
            {
                TableServiceContext context = cloudTableClient.GetDataServiceContext();
                var entity = new UserPrivilege { UserId = "UserId", Privilege = "Privilege" };

                context.AddObject(PrivilegesTableServiceContext.UserPrivilegeTableName, entity);
                context.SaveChangesWithRetries();
                context.DeleteObject(entity);
                context.SaveChangesWithRetries();
            }
        }
開發者ID:kirpasingh,項目名稱:MicrosoftAzureTrainingKit,代碼行數:16,代碼來源:CloudStorageInitializer.cs

示例14: GetRdfMetadataColumnNamespace

        public static List<TableColumnsMetadataEntity> GetRdfMetadataColumnNamespace(string entitySet)
        {
            CloudTableClient tableClient = new CloudTableClient(s_account.TableEndpoint.ToString(), s_account.Credentials);

            TableServiceContext tableServiceContext = tableClient.GetDataServiceContext();

            string queryTemplate = "{0}?$filter=entityset eq '{1}'";

            string query = string.Format(queryTemplate, DataLoaderConstants.TableColumnsMetadataTableName, entitySet);
            List<TableColumnsMetadataEntity> resultsQuery = tableServiceContext.Execute<TableColumnsMetadataEntity>(new Uri(query, UriKind.Relative)).ToList();
            if (resultsQuery.Count > 0)
            {
                return resultsQuery;
            }
            else
            {
                return null;
            }
        }
開發者ID:aytacozkan,項目名稱:OGDI-DataLab,代碼行數:19,代碼來源:TableDataLoader.cs

示例15: GeneratePastEventLogMessagesForConferenceManagement

        public void GeneratePastEventLogMessagesForConferenceManagement(
            CloudTableClient messageLogClient, string messageLogName,
            string conferenceManagementConnectionString,
            IMetadataProvider metadataProvider, ITextSerializer serializer)
        {
            retryPolicy.ExecuteAction(() => messageLogClient.CreateTableIfNotExist(messageLogName));

            // set the creation date to just before releasing V1 (previous month).
            var eventCreationDate = new DateTime(2012, 04, 01, 0, 0, 0, DateTimeKind.Utc);

            var generatedEvents = this.GenerateMissedConferenceManagementIntegrationEvents(conferenceManagementConnectionString);
            foreach (var evt in generatedEvents)
            {
                // generate events in ascending order. If there is a conflict when saving (currently silently swallowed by AzureEventLogWriter), 
                // then the migration process is being run for the second time, which is wrong.
                // TODO: what happens if the process crashes middleway.
                eventCreationDate = eventCreationDate.AddSeconds(1);
                var metadata = metadataProvider.GetMetadata(evt);
                var entry = new MessageLogEntity
                {
                    PartitionKey = eventCreationDate.ToString("yyyMM"),
                    // could have a prefix instead of suffix to be able to search
                    RowKey = eventCreationDate.Ticks.ToString("D20") + "_Generated",
                    CreationDate = eventCreationDate.ToString("o"),
                    MessageId = null,
                    CorrelationId = null,
                    SourceType = null,
                    SourceId = evt.SourceId.ToString(),
                    AssemblyName = metadata[StandardMetadata.AssemblyName],
                    FullName = metadata[StandardMetadata.FullName],
                    Namespace = metadata[StandardMetadata.Namespace],
                    TypeName = metadata[StandardMetadata.TypeName],
                    Kind = StandardMetadata.EventKind,
                    Payload = serializer.Serialize(evt),
                };

                var context = messageLogClient.GetDataServiceContext();
                context.AddObject(messageLogName, entry);
                retryPolicy.ExecuteAction(() => context.SaveChanges());
            }
        }
開發者ID:AlexShkorParalect,項目名稱:cqrs-journey-code,代碼行數:41,代碼來源:Migrator.cs


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