Esempio n. 1
0
 public WebSiteRepository(IAzureStorageFactory factory)
 {
     _webSiteTable = factory.GetTable <WebSiteRow>(typeof(WebSiteRow).Name);
     _bindingTable = factory.GetTable <BindingRow>(typeof(BindingRow).Name);
     _webSiteTable.Initialize();
     _bindingTable.Initialize();
 }
        public WindowsAzureEndpointRepository(IAzureTable<EndpointTableRow> table)
        {
            this.Table = table;

            // Create the Push User Endpoints table if does not exist.
            this.Table.CreateIfNotExist();
        }
 public WebSiteRepository(IAzureStorageFactory factory)
 {
     _webSiteTable = factory.GetTable<WebSiteRow>(typeof(WebSiteRow).Name);
     _bindingTable = factory.GetTable<BindingRow>(typeof(BindingRow).Name);
     _webSiteTable.Initialize();
     _bindingTable.Initialize();
 }
        public WindowsAzureEndpointRepository(IAzureTable <EndpointTableRow> table)
        {
            this.Table = table;

            // Create the Push User Endpoints table if does not exist.
            this.Table.CreateIfNotExist();
        }
Esempio n. 5
0
        private void SetupProbeTable()
        {
            //setup probe table
            CloudStorageAccount storageAccount = CloudStorageAccount.Parse(realCloudStorageAccount);

            _probeTable = new AzureTable <ProbeSnapshotEntry>(storageAccount);
            _probeTable.CreateIfNotExist();
        }
Esempio n. 6
0
        public StatisticsRepository(IAzureTable <UserStats> statsTable)
        {
            if (statsTable == null)
            {
                throw new ArgumentNullException("statsTable");
            }

            this.statsTable = statsTable;
        }
 public SurveyStore(
     IAzureTable <SurveyRow> surveyTable,
     IAzureTable <QuestionRow> questionTable,
     IInitializationStatusService initializationStatusService)
 {
     this.surveyTable   = surveyTable;
     this.questionTable = questionTable;
     this.CacheEnabled  = initializationStatusService.IsInitialized;
 }
        public StatisticsRepository(IAzureTable<UserStats> statsTable)
        {
            if (statsTable == null)
            {
                throw new ArgumentNullException("statsTable");
            }

            this.statsTable = statsTable;
        }
Esempio n. 9
0
 public SurveyStore(
     IAzureTable <SurveyRow> surveyTable,
     IAzureTable <QuestionRow> questionTable,
     ISurveyAnswerContainerFactory surveyAnswerContainerFactory)
 {
     this.surveyTable   = surveyTable;
     this.questionTable = questionTable;
     this.surveyAnswerContainerFactory = surveyAnswerContainerFactory;
     this.CacheEnabled = false;
 }
Esempio n. 10
0
 public SurveyStore(
     IAzureTable<SurveyRow> surveyTable, 
     IAzureTable<QuestionRow> questionTable,
     ISurveyAnswerContainerFactory surveyAnswerContainerFactory)
 {
     this.surveyTable = surveyTable;
     this.questionTable = questionTable;
     this.surveyAnswerContainerFactory = surveyAnswerContainerFactory;
     this.CacheEnabled = false;
 }
Esempio n. 11
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ProbeController"/> class.
        /// </summary>
        /// <param name="context">The context.</param>
        public ProbeController(IDbContext context)
            : base(context)
        {
            //Get the Azure Storage Account
            string connection = ConfigurationManager.ConnectionStrings[WadConnectionString].ConnectionString;
            CloudStorageAccount storageAccount = CloudStorageAccount.Parse(connection);

            _probeTable = new AzureTable <ProbeSnapshotEntry>(storageAccount);
            _probeTable.CreateIfNotExist();
        }
 public SurveyStore(
     IAzureTable <SurveyRow> surveyTable,
     IAzureTable <QuestionRow> questionTable,
     IUDFAzureTable surveyTableExtension)
 {
     this.surveyTable          = surveyTable;
     this.questionTable        = questionTable;
     this.surveyTableExtension = surveyTableExtension;
     this.CacheEnabled         = false;
 }
Esempio n. 13
0
        private static SurveyRow GetSurveyRowByTenantAndSlugName(IAzureTable <SurveyRow> surveyTable, string tenant, string slugName)
        {
            var rowKey = string.Format(CultureInfo.InvariantCulture, "{0}_{1}", tenant, slugName);

            var query = from s in surveyTable.Query
                        where s.RowKey == rowKey
                        select s;

            return(surveyTable.GetRetryPolicyFactoryInstance().GetDefaultAzureStorageRetryPolicy().ExecuteAction <SurveyRow>(() => query.SingleOrDefault()));
        }
Esempio n. 14
0
        protected override void FixtureSetup()
        {
            base.FixtureSetup();

            // RoleEnvironment
            AzureRoleEnvironment.DeploymentId          = () => "DEPLOYMENTID";
            AzureRoleEnvironment.CurrentRoleInstanceId = () => "ROLEINSTANCEID";

            // File Resource Paths
            var basePath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().CodeBase.Replace("file:///", ""));

            _sitePath      = Path.Combine(basePath, "Sites");
            _tempPath      = Path.Combine(basePath, "Temp");
            _configPath    = Path.Combine(basePath, "Config");
            _resourcesPath = Path.Combine(basePath, "_resources");
            Directory.CreateDirectory(_sitePath);
            Directory.CreateDirectory(_tempPath);
            Directory.CreateDirectory(_configPath);

            // Website Repository
            var factory = new AzureStorageFactory(CloudStorageAccount.DevelopmentStorageAccount);

            _repo         = new WebSiteRepository(factory);
            _webSiteTable = factory.GetTable <WebSiteRow>(typeof(WebSiteRow).Name);
            _bindingTable = factory.GetTable <BindingRow>(typeof(BindingRow).Name);

            // Clean up IIS and table storage to prepare for test
            using (var serverManager = new ServerManager())
            {
                _excludedSites = new List <string>();
                using (var manager = new ServerManager())
                {
                    manager.Sites.Where(s => s.Name != AzureRoleEnvironment.RoleWebsiteName()).ToList().ForEach(s => _excludedSites.Add(s.Name));
                }
                CleanupWebsiteTest(serverManager);
            }

            // Sync Service
            _syncService = new SyncService(
                _repo,
                new SyncStatusRepository(factory),
                CloudStorageAccount.DevelopmentStorageAccount,
                _sitePath,
                _tempPath,
                new string[] { },
                _excludedSites,
                () => true,
                new IISManager(_sitePath, _tempPath, new SyncStatusRepository(factory), new ConsoleFactory(), LoggerLevel.Debug),
                new ConsoleFactory(),
                LoggerLevel.Debug
                );
        }
        private static async Task <SurveyRow> GetSurveyRowByTenantAndSlugNameAsync(IAzureTable <SurveyRow> surveyTable, string tenant, string slugName)
        {
            var rowKey = string.Format(CultureInfo.InvariantCulture, "{0}_{1}", tenant, slugName);

            var surveys = await surveyTable.GetByRowKeyAsync(rowKey);

            if (surveys == null)
            {
                return(null);
            }

            return(surveys.SingleOrDefault());
        }
Esempio n. 16
0
        private static IList <WebSiteRow> CreateAndSaveWebSiteRows(IAzureTable <WebSiteRow> table, int count)
        {
            var sites = new List <WebSiteRow>();

            for (var k = 0; k < count; k++)
            {
                sites.Add(CreateWebSiteRow());
            }

            table.Add(sites);

            return(sites);
        }
Esempio n. 17
0
        public PersonRepository(IPersonMapper iPersonMapper,
                                IOptionsMonitor <AzureTableOptions> options)
        {
            if (options == null)
            {
                throw new ArgumentNullException(nameof(options));
            }

            this.iPersonMapper = iPersonMapper ?? throw new ArgumentNullException(nameof(iPersonMapper));

            this.azureTable = new AzureTable <PersonDb>(
                options.CurrentValue.ConnectionString,
                options.CurrentValue.PersonTableName);
        }
 public SyncStatusRepository(IAzureStorageFactory storageFactory)
 {
     _table = storageFactory.GetTable<SyncStatusRow>(typeof (SyncStatusRow).Name);
     _table.Initialize();
 }
Esempio n. 19
0
        private static SurveyRow GetSurveyRowByTenantAndSlugName(IAzureTable<SurveyRow> surveyTable, string tenant, string slugName)
        {
            var rowKey = string.Format(CultureInfo.InvariantCulture, "{0}_{1}", tenant, slugName);

            var query = from s in surveyTable.Query
                        where s.RowKey == rowKey
                        select s;

            return surveyTable.GetRetryPolicyFactoryInstance().GetDefaultAzureStorageRetryPolicy().ExecuteAction<SurveyRow>(() => query.SingleOrDefault());
        }
 public StatisticsRepository(IAzureTable<UserStats> statsTable)
 {
     // TODO: Add Constructor logic
 }
Esempio n. 21
0
 public SyncStatusRepository(IAzureStorageFactory storageFactory)
 {
     _table = storageFactory.GetTable <SyncStatusRow>(typeof(SyncStatusRow).Name);
     _table.Initialize();
 }
 public void Setup()
 {
     var factory = new AzureStorageFactory(CloudStorageAccount.DevelopmentStorageAccount);
     _repository = new WebSiteRepository(factory);
     _webSiteTable = factory.GetTable<WebSiteRow>(typeof(WebSiteRow).Name);
     _bindingTable = factory.GetTable<BindingRow>(typeof(BindingRow).Name);
 }
        private static async Task <IEnumerable <QuestionRow> > GetSurveyQuestionRowsByTenantAndSlugNameAsync(IAzureTable <QuestionRow> questionTable, string tenant, string slugName)
        {
            var paritionKey = string.Format(CultureInfo.InvariantCulture, "{0}_{1}", tenant, slugName);

            return(await questionTable.GetByPartitionKeyAsync(paritionKey));
        }
Esempio n. 24
0
 public AzureRepository(CloudStorageAccount storageAccount)
 {
     this._table = typeof(IEnum).IsAssignableFrom(typeof(TEntity)) ?
                   new AzureTable <TAzureEntity>(storageAccount, "Enum") :
                   new AzureTable <TAzureEntity>(storageAccount, typeof(TEntity).Name);
 }
Esempio n. 25
0
        private static IEnumerable <QuestionRow> GetSurveyQuestionRowsByTenantAndSlugName(IAzureTable <QuestionRow> questionTable, string tenant, string slugName)
        {
            var paritionKey = string.Format(CultureInfo.InvariantCulture, "{0}_{1}", tenant, slugName);

            var query = from q in questionTable.Query
                        where q.PartitionKey == paritionKey
                        select q;

            return(questionTable.GetRetryPolicyFactoryInstance().GetDefaultAzureStorageRetryPolicy().ExecuteAction <IEnumerable <QuestionRow> >(() => query.ToList()));
        }
        protected override void FixtureSetup()
        {
            base.FixtureSetup();

            // RoleEnvironment
            AzureRoleEnvironment.DeploymentId = () => "DEPLOYMENTID";
            AzureRoleEnvironment.CurrentRoleInstanceId = () => "ROLEINSTANCEID";

            // File Resource Paths
            var basePath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().CodeBase.Replace("file:///", ""));
            _sitePath = Path.Combine(basePath, "Sites");
            _tempPath = Path.Combine(basePath, "Temp");
            _configPath = Path.Combine(basePath, "Config");
            _resourcesPath = Path.Combine(basePath, "_resources");
            Directory.CreateDirectory(_sitePath);
            Directory.CreateDirectory(_tempPath);
            Directory.CreateDirectory(_configPath);

            // Website Repository
            var factory = new AzureStorageFactory(CloudStorageAccount.DevelopmentStorageAccount);
            _repo = new WebSiteRepository(factory);
            _webSiteTable = factory.GetTable<WebSiteRow>(typeof(WebSiteRow).Name);
            _bindingTable = factory.GetTable<BindingRow>(typeof(BindingRow).Name);

            // Clean up IIS and table storage to prepare for test
            using (var serverManager = new ServerManager())
            {
                _excludedSites = new List<string>();
                using (var manager = new ServerManager())
                {
                    manager.Sites.Where(s => s.Name != AzureRoleEnvironment.RoleWebsiteName()).ToList().ForEach(s => _excludedSites.Add(s.Name));
                }
                CleanupWebsiteTest(serverManager);
            }

            // Sync Service
            _syncService = new SyncService(
                _repo,
                new SyncStatusRepository(factory),
                CloudStorageAccount.DevelopmentStorageAccount,
                _sitePath,
                _tempPath,
                new string[] { },
                _excludedSites,
                () => true,
                new IISManager(_sitePath, _tempPath, new SyncStatusRepository(factory), new ConsoleFactory(), LoggerLevel.Debug),
                new ConsoleFactory(),
                LoggerLevel.Debug
            );
        }
Esempio n. 27
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ProbeController"/> class.
 /// </summary>
 /// <param name="context">The context.</param>
 /// <param name="probeTable">The probe table.</param>
 public ProbeController(IDbContext context, IAzureTable <ProbeSnapshotEntry> probeTable)
     : base(context)
 {
     _probeTable = probeTable;
 }
 public StatisticsRepository(IAzureTable <UserStats> statsTable)
 {
     // TODO: Add Constructor logic
 }
        private static IList<WebSiteRow> CreateAndSaveWebSiteRows(IAzureTable<WebSiteRow> table, int count)
        {
            var sites = new List<WebSiteRow>();

            for (var k = 0; k < count; k++)
            {
                sites.Add(CreateWebSiteRow());
            }

            table.Add(sites);

            return sites;
        }
Esempio n. 30
0
        private static IEnumerable<QuestionRow> GetSurveyQuestionRowsByTenantAndSlugName(IAzureTable<QuestionRow> questionTable, string tenant, string slugName)
        {
            var paritionKey = string.Format(CultureInfo.InvariantCulture, "{0}_{1}", tenant, slugName);

            var query = from q in questionTable.Query
                        where q.PartitionKey == paritionKey
                        select q;

            return questionTable.GetRetryPolicyFactoryInstance().GetDefaultAzureStorageRetryPolicy().ExecuteAction<IEnumerable<QuestionRow>>(() => query.ToList());
        }