Пример #1
0
        static MsdnDataSource()
        {
            CloudStorageAccount.SetConfigurationSettingPublisher((configName, configSetter) => {
                                                                         string connectionString = string.Empty;

                                                                         if (RoleEnvironment.IsAvailable) {
                                                                             connectionString = RoleEnvironment.GetConfigurationSettingValue(configName);
                                                                         }
                                                                         //else {
                                                                         //    connectionString = ConfigurationManager.AppSettings[configName];
                                                                         //}

                                                                         configSetter(connectionString);
                                                                     });

            storageAccount = CloudStorageAccount.FromConfigurationSetting("DataConnectionString");

            storageAccount.CreateCloudTableClient().CreateTableIfNotExist("Namespaces");
            storageAccount.CreateCloudTableClient().CreateTableIfNotExist("Types");
            storageAccount.CreateCloudTableClient().CreateTableIfNotExist("Members");

            //CloudTableClient.CreateTablesFromModel(
            //    typeof(NamespaceMetaInfo),
            //    storageAccount.TableEndpoint.AbsoluteUri,
            //    storageAccount.Credentials);
        }
 public PushServiceTokenRepository()
 {
     storage = CloudStorageAccount.Parse(RoleEnvironment.GetConfigurationSettingValue("StorageConnectionString"));
     client = storage.CreateCloudTableClient();
     client.CreateTableIfNotExist(TableName);
     context = client.GetDataServiceContext();
 }
Пример #3
0
 public AzureCommandLogReader(CloudStorageAccount account, string tableName, ITextSerializer serializer) : 
     base(account, tableName, serializer)
 {
     this.tableName = tableName;
     this.serializer = serializer;
     this.tableClient = account.CreateCloudTableClient();
 }
        public UserDataSource(CloudStorageAccount storageAccount)
        {
            _storageAccount = storageAccount;
            _cloudTableClient = storageAccount.CreateCloudTableClient();

            _cloudTableClient.CreateTableIfNotExist("Users");
        }
 public FriendshipRepository()
 {
     storage = CloudStorageAccount.Parse(ConfigurationManager.AppSettings["StorageConnectionString"]);
     client = storage.CreateCloudTableClient();
     client.CreateTableIfNotExist(TableName);
     context = client.GetDataServiceContext();
 }
Пример #6
0
        public EventStore(CloudStorageAccount account, string tableName)
        {
            if (account == null) throw new ArgumentNullException("account");
            if (tableName == null) throw new ArgumentNullException("tableName");
            if (string.IsNullOrWhiteSpace(tableName)) throw new ArgumentException("tableName");

            this.account = account;
            this.tableName = tableName;
            this.tableClient = account.CreateCloudTableClient();
            this.tableClient.RetryPolicy = RetryPolicies.NoRetry();

            // TODO: This could be injected.
            var backgroundRetryStrategy = new ExponentialBackoff(10, TimeSpan.FromMilliseconds(100), TimeSpan.FromSeconds(15), TimeSpan.FromSeconds(1));
            var blockingRetryStrategy = new Incremental(3, TimeSpan.FromMilliseconds(100), TimeSpan.FromSeconds(1));
            this.pendingEventsQueueRetryPolicy = new RetryPolicy<StorageTransientErrorDetectionStrategy>(backgroundRetryStrategy);
            this.pendingEventsQueueRetryPolicy.Retrying += (s, e) =>
            {
                var handler = this.Retrying;
                if (handler != null)
                {
                    handler(this, EventArgs.Empty);
                }

                Trace.TraceWarning("An error occurred in attempt number {1} to access table storage (PendingEventsQueue): {0}", e.LastException.Message, e.CurrentRetryCount);
            };
            this.eventStoreRetryPolicy = new RetryPolicy<StorageTransientErrorDetectionStrategy>(blockingRetryStrategy);
            this.eventStoreRetryPolicy.Retrying += (s, e) => Trace.TraceWarning(
                "An error occurred in attempt number {1} to access table storage (EventStore): {0}",
                e.LastException.Message,
                e.CurrentRetryCount);

            this.eventStoreRetryPolicy.ExecuteAction(() => tableClient.CreateTableIfNotExist(tableName));
        }
Пример #7
0
        public AzureEventStore(CloudStorageAccount storageAccount)
        {
            _account = storageAccount;
            _tableClient = _account.CreateCloudTableClient();

            InitializeStorage();
        }
Пример #8
0
        //ADD AILMENT DETAILS
        public void AddAilmentDetails(AilmentDetails AilData)
        {
            #if DEBUG
            account = CloudStorageAccount.DevelopmentStorageAccount;
            #else
            account = new CloudStorageAccount(accountAndKey, true);
            #endif
            client = account.CreateCloudTableClient();
            client.CreateTableIfNotExist("PatientDetails");
            tableContext = new TableServiceContext(account.TableEndpoint.ToString(), account.Credentials);

            AilmentDetails x = new AilmentDetails();
            x.AttendingPhysician = AilData.AttendingPhysician;
            x.Diagnosis = AilData.Diagnosis;
            x.DiagnosisID = AilData.DiagnosisID;
            x.GeneralPhysician = AilData.GeneralPhysician;
            x.Hospital = AilData.Hospital;
            x.Lab_Pathology = AilData.Lab_Pathology;
            x.Lab_Physical = AilData.Lab_Physical;
            x.Lab_Radiology = AilData.Lab_Physical;
            x.Medication = AilData.Medication;
            x.PatientIDLinkRowKey = AilData.PatientIDLinkRowKey;
            x.ProgressNotes = AilData.ProgressNotes;
            x.Symptoms = AilData.Symptoms;
            x.TimeIn = AilData.TimeIn;
            x.TimeOut = AilData.TimeOut;
            x.Treatment = AilData.Treatment;
            x.AilmentDetailRowKey = AilData.AilmentDetailRowKey;

            tableContext.AddObject("PatientDetails", x);
            tableContext.SaveChanges();
        }
Пример #9
0
 public ErrorMapContext()
 {
     StorageAccount = CloudStorageAccount.FromConfigurationSetting(ConfigurationName);
     CloudTableClient TableClient = StorageAccount.CreateCloudTableClient();
     TableClient.CreateTableIfNotExist(TableName);
     servCtx = TableClient.GetDataServiceContext();
 }
Пример #10
0
        public override bool OnStart()
        {
            // Set the maximum number of concurrent connections
            ServicePointManager.DefaultConnectionLimit = 12;
            #if DEBUG
            account = CloudStorageAccount.DevelopmentStorageAccount;
            #else
            account = new CloudStorageAccount(accountAndKey, true);
            #endif

            tableContext = new TableServiceContext(account.TableEndpoint.ToString(), account.Credentials);

            //client = new CloudQueueClient(account.BlobEndpoint.ToString(), account.Credentials);
            qclient = account.CreateCloudQueueClient();
            q = qclient.GetQueueReference("icd9mapplotrequests");
            rows = new List<ICD9MapPlotResultEntry>();
            bclient = account.CreateCloudBlobClient();
            container = bclient.GetContainerReference("results");
            container.CreateIfNotExist();
            client = account.CreateCloudTableClient();
            client.CreateTableIfNotExist("ICD9MapPlotResult");
            client.CreateTableIfNotExist("DoctorDetails");
            client.CreateTableIfNotExist("PatientDetails");
            // For information on handling configuration changes
            // see the MSDN topic at http://go.microsoft.com/fwlink/?LinkId=166357.

            return base.OnStart();
        }
        public static void InitializeCloudStorage(CloudStorageAccount account)
        {
            CloudTableClient cloudTableClient = account.CreateCloudTableClient();
            CloudQueueClient cloudQueueClient = account.CreateCloudQueueClient();

            CreateUserPrivilegeTable(cloudTableClient);
        }
 public PushServiceTokenRepository()
 {
     storage = CloudStorageAccount.Parse(ConfigurationManager.AppSettings["StorageConnectionString"]);
     client = storage.CreateCloudTableClient();
     client.CreateTableIfNotExist(TableName);
     context = new TableServiceContextV2(client.BaseUri.ToString(), client.Credentials);
 }
 public PushServiceTokenRepository()
 {
     storage = CloudStorageAccount.Parse(RoleEnvironment.GetConfigurationSettingValue("StorageConnectionString"));
     client = storage.CreateCloudTableClient();
     client.CreateTableIfNotExist(TableName);
     context = new TableServiceContextV2(client.BaseUri.ToString(), client.Credentials);
 }
Пример #14
0
 public void Setup()
 {
     var account = new CloudStorageAccount(new StorageCredentialsAccountAndKey(ACCOUNT_NAME, KEY), false);
     var tableClient = account.CreateCloudTableClient();
     tableClient.CreateTableIfNotExist(TABLE_NAME);
     var context = new DynamicTableContext(TABLE_NAME, new Credentials(ACCOUNT_NAME, KEY));
     context.InsertOrReplace(new { PartitionKey = "1", RowKey = "1", Value1 = "TEST" });
 }
Пример #15
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="cloudStorageAccount">connection to table</param>
        /// <param name="processName"></param>
        /// <param name="dateEntered"></param>
        public WebRoleMgr(CloudStorageAccount cloudStorageAccount, String processName, DateTime dateEntered)
        {
            this.cloudTableClient = cloudStorageAccount.CreateCloudTableClient();
            modelFactory = new AzureDataModelFactory(this.cloudTableClient);

            ProcessName = processName;
            DateEntered = dateEntered;
        }
        public NcqrsEventStoreContext(Guid eventSourceId,
            CloudStorageAccount account,
            string tablePrefix)
            : base(account.TableEndpoint.AbsoluteUri,
                account.Credentials)
        {
            this.IgnoreResourceNotFoundException = true;
            _eventSourceID = eventSourceId;
            _tablePrefix = tablePrefix;

            if (account == CloudStorageAccount.DevelopmentStorageAccount)
            {
                _usingDevelopment = true;
            }

            account.CreateCloudTableClient().CreateTableIfNotExist(EVENTTABLENAME);
            account.CreateCloudTableClient().CreateTableIfNotExist(EVENTSOURCETABLENAME);
        }
        public static void SetupTables(CloudStorageAccount account)
        {
            var client = account.CreateCloudTableClient();

            client.CreateTableIfNotExist(RelyingPartiesTable);
            client.CreateTableIfNotExist(ClientCertificatesTable);
            client.CreateTableIfNotExist(DelegationTable);
            client.CreateTableIfNotExist(UsersTable);
        }
        public CustomerRepoDapper()
        {
            connStr = ConfigurationManager.ConnectionStrings["DMTPrimary"].ConnectionString;

            storage = CloudStorageAccount.Parse(ConfigurationManager.AppSettings["StorageConnectionString"]);
            client = storage.CreateCloudTableClient();
            client.CreateTableIfNotExist(TableName);
            context = new TableServiceContextV2(client.BaseUri.ToString(), client.Credentials);
        }
Пример #19
0
        public SingleDeliveryQueueClient(CloudStorageAccount account, string queueName)
        {
            var queueClient = account.CreateCloudQueueClient();
            queue = queueClient.GetQueueReference(queueName);
            queue.CreateIfNotExist();

            tableClient = account.CreateCloudTableClient();
            tableClient.CreateTableIfNotExist(TableName);
        }
        public ActivityRepository()
        {
            storage = CloudStorageAccount.Parse(ConfigurationManager.AppSettings["StorageConnectionString"]);
            client = storage.CreateCloudTableClient();

            client.CreateTableIfNotExist(TableName);

            context = new TableServiceContextV2(client.BaseUri.ToString(), client.Credentials);
            context.IgnoreResourceNotFoundException = true;
        }
        public ChallengeStatusVoteRepository()
        {
            storage = CloudStorageAccount.Parse(RoleEnvironment.GetConfigurationSettingValue("StorageConnectionString"));
            client = storage.CreateCloudTableClient();

            client.CreateTableIfNotExist(TableName);

            context = new TableServiceContextV2(client.BaseUri.ToString(), client.Credentials);
            context.MergeOption = MergeOption.NoTracking;
        }
Пример #22
0
        public UserSettings(string accountName, string accountKey, string settingsTableName)
        {
            this.settingsTableName = settingsTableName;
            this.partitionTableName = settingsTableName + "UserDirectory";
            var account = new CloudStorageAccount(new StorageCredentialsAccountAndKey(accountName, accountKey), true);
            var tableClient = account.CreateCloudTableClient();

            tableClient.CreateTableIfNotExist(settingsTableName);
            tableClient.CreateTableIfNotExist(partitionTableName);
            settingsTableContext = tableClient.GetDataServiceContext();
        }
        public ChallengeStatusRepository()
        {
            storage = CloudStorageAccount.Parse(RoleEnvironment.GetConfigurationSettingValue("StorageConnectionString"));
            client = storage.CreateCloudTableClient();

            client.CreateTableIfNotExist(TableName);

            //context = client.GetDataServiceContext();
            context = new TableServiceContextV2(client.BaseUri.ToString(), client.Credentials);
            context.IgnoreResourceNotFoundException = true;
        }
        public AzureEventLogReader(CloudStorageAccount account, string tableName, ITextSerializer serializer)
        {
            if (account == null) throw new ArgumentNullException("account");
            if (tableName == null) throw new ArgumentNullException("tableName");
            if (string.IsNullOrWhiteSpace(tableName)) throw new ArgumentException("tableName");
            if (serializer == null) throw new ArgumentNullException("serializer");

            this.account = account;
            this.tableName = tableName;
            this.tableClient = account.CreateCloudTableClient();
            this.serializer = serializer;
        }
        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();
        }
        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();
        }
Пример #27
0
        public static void Initialize(string account, string key)
        {
            Uri blobUri = new Uri(string.Format("http://{0}.blob.core.windows.net", account));
            Uri queueUri = new Uri(string.Format("http://{0}.queue.core.windows.net", account));
            Uri tableUri = new Uri(string.Format("http://{0}.table.core.windows.net", account));

            s_credentials = new StorageCredentialsAccountAndKey(account, key);
            s_storageAccount = new CloudStorageAccount(s_credentials, blobUri, queueUri, tableUri);

            s_blobClient = s_storageAccount.CreateCloudBlobClient();
            s_tableClient = s_storageAccount.CreateCloudTableClient();
            s_queueClient = s_storageAccount.CreateCloudQueueClient();
        }
        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();
        }
Пример #29
0
        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();
        }
        public AzureMessageLogWriter(CloudStorageAccount account, string tableName)
        {
            if (account == null) throw new ArgumentNullException("account");
            if (tableName == null) throw new ArgumentNullException("tableName");
            if (string.IsNullOrWhiteSpace(tableName)) throw new ArgumentException("tableName");

            this.account = account;
            this.tableName = tableName;
            this.tableClient = account.CreateCloudTableClient();
            this.tableClient.RetryPolicy = RetryPolicies.NoRetry();

            var retryStrategy = new ExponentialBackoff(10, TimeSpan.FromMilliseconds(100), TimeSpan.FromSeconds(15), TimeSpan.FromSeconds(1));
            this.retryPolicy = new RetryPolicy<StorageTransientErrorDetectionStrategy>(retryStrategy);

            this.retryPolicy.ExecuteAction(() => tableClient.CreateTableIfNotExist(tableName));
        }