public void AddEventMessage(EventMessage msg) { this.context = new EventMessageDataContext(storageAccount.TableEndpoint.AbsoluteUri, storageAccount.Credentials); this.context.RetryPolicy = RetryPolicies.Retry(3, TimeSpan.FromSeconds(1)); this.context.AddObject(this.context.EventMessageTableName, msg); this.context.SaveChanges(); }
//static EventMessageDataSource() //{ // CloudStorageAccount.SetConfigurationSettingPublisher((configName, configSetter) => // { // configSetter(RoleEnvironment.GetConfigurationSettingValue(configName)); // }); // storageAccount = CloudStorageAccount.FromConfigurationSetting("DataConnectionString"); // CloudTableClient.CreateTablesFromModel( // typeof(EventMessageDataContext), // storageAccount.TableEndpoint.AbsoluteUri, // storageAccount.Credentials); //} public EventMessageDataSource() { CloudStorageAccount.SetConfigurationSettingPublisher((configName, configSetter) => { configSetter(RoleEnvironment.GetConfigurationSettingValue(configName)); }); storageAccount = CloudStorageAccount.FromConfigurationSetting("DataConnectionString"); CloudTableClient.CreateTablesFromModel( typeof(EventMessageDataContext), storageAccount.TableEndpoint.AbsoluteUri, storageAccount.Credentials); context = new EventMessageDataContext(storageAccount.TableEndpoint.AbsoluteUri, storageAccount.Credentials); context.RetryPolicy = RetryPolicies.Retry(3, TimeSpan.FromSeconds(5)); }
public EventMessageDataSource() { this.context = new EventMessageDataContext(storageAccount.TableEndpoint.AbsoluteUri, storageAccount.Credentials); this.context.RetryPolicy = RetryPolicies.Retry(3, TimeSpan.FromSeconds(1)); }