Inheritance: Microsoft.WindowsAzure.StorageClient.TableServiceContext
        public RoleInfoDataSource()
        {
            this.storageAccount = CloudStorageAccount.Parse(RoleEnvironment.GetConfigurationSettingValue("DataConnectionString"));
            //this.storageAccount = CloudStorageAccount.FromConfigurationSetting("DataConnectionString");
            //CloudTableClient.CreateTablesFromModel(typeof(RoleInfoDataContext), storageAccount.TableEndpoint.AbsoluteUri, storageAccount.Credentials);

            CloudTableClient client = new CloudTableClient(storageAccount.TableEndpoint.AbsoluteUri, storageAccount.Credentials);
            client.CreateTableIfNotExist(entitySetName);

            this.context = new RoleInfoDataContext(storageAccount.TableEndpoint.AbsoluteUri, storageAccount.Credentials);
            this.context.RetryPolicy = RetryPolicies.Retry(3, TimeSpan.FromSeconds(1));
        }
Exemple #2
0
        public RoleInfoDataSource()
        {
            this.storageAccount = CloudStorageAccount.Parse(RoleEnvironment.GetConfigurationSettingValue("DataConnectionString"));
            //this.storageAccount = CloudStorageAccount.FromConfigurationSetting("DataConnectionString");
            //CloudTableClient.CreateTablesFromModel(typeof(RoleInfoDataContext), storageAccount.TableEndpoint.AbsoluteUri, storageAccount.Credentials);

            CloudTableClient client = new CloudTableClient(storageAccount.TableEndpoint.AbsoluteUri, storageAccount.Credentials);

            client.CreateTableIfNotExist(entitySetName);

            this.context             = new RoleInfoDataContext(storageAccount.TableEndpoint.AbsoluteUri, storageAccount.Credentials);
            this.context.RetryPolicy = RetryPolicies.Retry(3, TimeSpan.FromSeconds(1));
        }