/// <summary>
        /// Mockable Constructor
        /// </summary>
        public DataStore(IImaging imaging, IContainer container, ITableStorage table, IStorageQueue queue, INaming naming, uint cacheControlDuration = 31536000)
        {
            if (null == imaging)
            {
                throw new ArgumentNullException("imaging");
            }
            if (null == container)
            {
                throw new ArgumentNullException("container");
            }
            if (null == table)
            {
                throw new ArgumentNullException("table");
            }
            if (null == queue)
            {
                throw new ArgumentNullException("queue");
            }
            if (null == naming)
            {
                throw new ArgumentNullException("naming");
            }

            this.imaging              = imaging;
            this.container            = container;
            this.table                = table;
            this.queue                = queue;
            this.naming               = naming;
            this.cacheControlDuration = cacheControlDuration < 0 ? 31536000 : cacheControlDuration;
        }
 /// <summary>
 /// Pwned Passwords - Append handler
 /// </summary>
 /// <param name="blobStorage">The Blob storage</param>
 public ProcessTransaction(ILogger <ProcessTransaction> log, ITableStorage tableStorage, IQueueStorage queueStorage, IFileStorage fileStorage)
 {
     _log          = log;
     _tableStorage = tableStorage;
     _queueStorage = queueStorage;
     _fileStorage  = fileStorage;
 }
示例#3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="StudentService"/> class.
 /// </summary>
 /// <param name="emailService">The emailService<see cref="IEmailService"/>.</param>
 /// <param name="tableStorage">The tableStorage<see cref="ITableStorage"/>.</param>
 /// <param name="mapper">The mapper<see cref="IMapper"/>.</param>
 /// <param name="azureBlobService">The azureBlobService<see cref="IAzureBlobService"/>.</param>
 public StudentService(IEmailService emailService, ITableStorage tableStorage, IMapper mapper, IAzureBlobService azureBlobService)
 {
     _tableStorage     = tableStorage;
     _mapper           = mapper;
     _emailService     = emailService;
     _azureBlobService = azureBlobService;
 }
示例#4
0
 /// <summary>
 /// Pwned Passwords - Append handler
 /// </summary>
 /// <param name="blobStorage">The Blob storage</param>
 public ProcessPwnedPasswordEntry(ILogger <ProcessPwnedPasswordEntry> log, ITableStorage tableStorage, IFileStorage blobStorage, IQueueStorage queueStorage)
 {
     _log          = log;
     _tableStorage = tableStorage;
     _blobStorage  = blobStorage;
     _queueStorage = queueStorage;
 }
 public ExpandedContentEnhancedItemsManager(ITableStorage tableStorage, GlobalSearchTermRepository globalSearchTermRepository, ILocalization localization)
 {
     _tableStorage = tableStorage;
     _globalSearchTermRepository = globalSearchTermRepository;
     _localization = localization;
     _expandedContentEnhancedItemsProcessor = new ExpandedContentEnhancedItemsProcessor();
 }
示例#6
0
        public void Init()
        {
            var table = 'a' + Guid.NewGuid().ToString().ToLowerInvariant().Replace('-', 'a');

            this.storage = new TableStorage(table, TestHelpers.DevConnectionString);
            storage.CreateIfNotExists().Wait();
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="TeacherService"/> class.
 /// </summary>
 /// <param name="emailService">The emailService<see cref="IEmailService"/>.</param>
 /// <param name="tableStorage">The tableStorage<see cref="ITableStorage"/>.</param>
 /// <param name="mapper">The mapper<see cref="IMapper"/>.</param>
 /// <param name="profileService">The profileService<see cref="IProfileService"/>.</param>
 public TeacherService(IEmailService emailService, ITableStorage tableStorage, IMapper mapper, IProfileService profileService)
 {
     _tableStorage   = tableStorage;
     _mapper         = mapper;
     _profileService = profileService;
     _emailService   = emailService;
 }
示例#8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SchoolService"/> class.
 /// </summary>
 /// <param name="tableStorage">The tableStorage<see cref="ITableStorage"/>.</param>
 /// <param name="mapper">The mapper<see cref="IMapper"/>.</param>
 /// <param name="classService">The classService<see cref="IClassService"/>.</param>
 /// <param name="teacherService">The teacherService<see cref="ITeacherService"/>.</param>
 public SchoolService(ITableStorage tableStorage, IMapper mapper, IClassService classService, ITeacherService teacherService)
 {
     _tableStorage   = tableStorage;
     _mapper         = mapper;
     _classService   = classService;
     _teacherService = teacherService;
 }
示例#9
0
        protected TableStorageTest(string name)
        {
            _settings = new ConfigurationBuilder <ITestSettings>()
                        .UseIniFile("c:\\tmp\\integration-tests.ini")
                        .UseEnvironmentVariables()
                        .Build();

            _name = name;

            if (_name == "csv-files")
            {
                _tables = StorageFactory.Tables.CsvFiles(TestDir);
            }
            else if (_name == "azure")
            {
                _tables = StorageFactory.Tables.AzureTableStorage(
                    _settings.AzureStorageName,
                    _settings.AzureStorageKey);
            }
            else if (_name == "mssql")
            {
                _tables = StorageFactory.Tables.MssqlServer(
                    _settings.MssqlConnectionString);
            }

            /*else if(_name == "esent")
             * {
             * _tables = StorageFactory.Tables.Esent(
             *    Path.Combine(TestDir.FullName, "test.edb"));
             * }*/

            _tableName = "TableStorageTest" + Guid.NewGuid().ToString().Replace("-", "");
            //_tableName = "TableStorageTest";
        }
示例#10
0
        public void Init()
        {
            var table = "testing";

            this.storage = new TableStorage(table, ConnectionString);
            storage.CreateIfNotExists().Wait();
        }
示例#11
0
        /// <summary>
        /// Mockable Constructor
        /// </summary>
        public DataStore(IImaging imaging, IContainer container, ITableStorage table, IStorageQueue queue, INaming naming, uint cacheControlDuration = 31536000)
        {
            if (null == imaging)
            {
                throw new ArgumentNullException("imaging");
            }
            if (null == container)
            {
                throw new ArgumentNullException("container");
            }
            if (null == table)
            {
                throw new ArgumentNullException("table");
            }
            if (null == queue)
            {
                throw new ArgumentNullException("queue");
            }
            if (null == naming)
            {
                throw new ArgumentNullException("naming");
            }

            this.imaging = imaging;
            this.container = container;
            this.table = table;
            this.queue = queue;
            this.naming = naming;
            this.cacheControlDuration = cacheControlDuration < 0 ? 31536000 : cacheControlDuration;
        }
 public MonsterManualManager(ITableStorage tableStorage, GlobalSearchTermRepository globalSearchTermRepository, ILocalization localization)
 {
     _tableStorage = tableStorage;
     _globalSearchTermRepository = globalSearchTermRepository;
     _localization     = localization;
     _monsterProcessor = new MonsterProcessor();
 }
示例#13
0
 public UserInfoModule(
     ILogger <UserInfoModule> logger,
     ITableStorage tableStorage)
 {
     _logger       = logger;
     _tableStorage = tableStorage;
 }
示例#14
0
 public SearchManager(ITableStorage tableStorage, GlobalSearchTermRepository globalSearchTermRepository, ILocalization localization, SearchServiceClient searchServiceClient)
 {
     _tableStorage = tableStorage;
     _globalSearchTermRepository = globalSearchTermRepository;
     _localization        = localization;
     _searchServiceClient = searchServiceClient;
 }
 public void Setup()
 {
     var elements = new StorageElements();
     this.container = new Container(elements.Container, connectionString);
     this.container.CreateIfNotExists().Wait();
     this.table = new TableStorage(elements.Table, connectionString);
     this.table.CreateIfNotExists().Wait();
 }
示例#16
0
 public IngressActor(ActorSystem system, ITableStorage tableStorage)
 {
     _system       = system;
     _tableStorage = tableStorage;
     ReceiveAsync <StartListening>(OnStart);
     ReceiveAsync <StopListening>(OnStop);
     ReceiveAsync <DispatchEventData>(OnDispatch);
 }
示例#17
0
 public IngressActor(IngressActorProvider provider, ITableStorage tableStorage)
 {
     _provider     = provider;
     _tableStorage = tableStorage;
     ReceiveAsync <StartListening>(OnStart);
     ReceiveAsync <StopListening>(OnStop);
     ReceiveAsync <DispatchEventData>(OnDispatch);
 }
 public ExpandedContentCustomizationOptionsManager(ITableStorage tableStorage,
                                                   GlobalSearchTermRepository globalSearchTermRepository, ILocalization localization)
 {
     _tableStorage = tableStorage;
     _expandedContentCustomizationOptionsProcessor = new ExpandedContentCustomizationOptionsProcessor();
     _globalSearchTermRepository = globalSearchTermRepository;
     _localization = localization;
 }
示例#19
0
        /// <summary>
        /// Inserts a single row
        /// </summary>
        /// <param name="storage">Table storage reference</param>
        /// <param name="tableName">Table name, required.</param>
        /// <param name="row">Row to insert, required.</param>
        /// <exception cref="StorageException">
        /// If the row already exists throws this exception with <see cref="ErrorCode.DuplicateKey"/>
        /// </exception>
        public static void Insert(this ITableStorage storage, string tableName, TableRow row)
        {
            if (row == null)
            {
                throw new ArgumentNullException(nameof(row));
            }

            storage.Insert(tableName, new[] { row });
        }
示例#20
0
        /// <summary>
        /// Deletes a single row
        /// <param name="storage">Table storage reference</param>
        /// <param name="tableName">Table name, required.</param>
        /// <param name="rowId">Row ID to delete, required.</param>
        /// </summary>
        public static void Delete(this ITableStorage storage, string tableName, TableRowId rowId)
        {
            if (rowId == null)
            {
                return;
            }

            storage.Delete(tableName, new[] { rowId });
        }
示例#21
0
        /// <summary>
        /// Deletes a single row
        /// <param name="storage">Table storage reference</param>
        /// <param name="tableName">Table name, required.</param>
        /// <param name="rowId">Row ID to delete, required.</param>
        /// </summary>
        public static async Task DeleteAsync(this ITableStorage storage, string tableName, TableRowId rowId)
        {
            if (rowId == null)
            {
                return;
            }

            await storage.DeleteAsync(tableName, new[] { rowId });
        }
示例#22
0
        /// <summary>
        /// Merges a single row
        /// <param name="storage">Table storage reference</param>
        /// <param name="tableName">Table name, required.</param>
        /// <param name="row">Row to insert, required.</param>
        /// </summary>
        public static async Task MergeAsync(this ITableStorage storage, string tableName, TableRow row)
        {
            if (row == null)
            {
                return;
            }

            await storage.MergeAsync(tableName, new[] { row });
        }
示例#23
0
        /// <summary>
        /// Merges a single row
        /// <param name="storage">Table storage reference</param>
        /// <param name="tableName">Table name, required.</param>
        /// <param name="row">Row to insert, required.</param>
        /// </summary>
        public static void Merge(this ITableStorage storage, string tableName, TableRow row)
        {
            if (row == null)
            {
                return;
            }

            storage.Merge(tableName, new[] { row });
        }
示例#24
0
 async Task LoadBooksAsync(ITableStorage <Book> books)
 {
     foreach (var book in File.ReadAllLines("Books.csv").Skip(1)
              .Select(line => line.Split(','))
              .Select(values => new Book(values[1], values[2], values[3], Enum.Parse <BookFormat>(values[4]), int.Parse(values[5]), bool.Parse(values[6]))))
     {
         await books.PutAsync(book);
     }
 }
        /// <summary>
        /// Mockable Constructor
        /// </summary>
        /// <param name="table">Table</param>
        public QueryDataStore(ITableStorage table)
        {
            if (null == table)
            {
                throw new ArgumentNullException("table");
            }

            this.table = table;
        }
示例#26
0
        /// <summary>
        /// Default Constructor
        /// </summary>
        /// <param name="table">Table Storage</param>
        public TableStorageWriter(ITableStorage table)
        {
            if (null == table)
            {
                throw new ArgumentNullException("table");
            }

            this.table = table;
        }
示例#27
0
        /// <summary>
        /// Default Constructor
        /// </summary>
        /// <param name="table">Table Storage</param>
        public TableStorageWriter(ITableStorage table)
        {
            if (null == table)
            {
                throw new ArgumentNullException("table");
            }

            this.table = table;
        }
示例#28
0
        public void Setup()
        {
            var elements = new StorageElements();

            this.container = new Container(elements.Container, connectionString);
            this.container.CreateIfNotExists().Wait();
            this.table = new TableStorage(elements.Table, connectionString);
            this.table.CreateIfNotExists().Wait();
        }
示例#29
0
        /// <summary>
        /// Mockable Constructor
        /// </summary>
        /// <param name="table">Table</param>
        public QueryDataStore(ITableStorage table)
        {
            if (null == table)
            {
                throw new ArgumentNullException("table");
            }

            this.table = table;
        }
示例#30
0
        /// <summary>
        /// Inserts a single row, or replaces the value if row already exists.
        /// </summary>
        /// <param name="storage">Table storage reference</param>
        /// <param name="tableName">Table name, required.</param>
        /// <param name="row">Row to insert, required.</param>
        public static void InsertOrReplace(this ITableStorage storage, string tableName, TableRow row)
        {
            if (row == null)
            {
                return;
            }

            storage.InsertOrReplace(tableName, new[] { row });
        }
示例#31
0
        /// <summary>
        /// Inserts a single row
        /// </summary>
        /// <param name="storage">Table storage reference</param>
        /// <param name="tableName">Table name, required.</param>
        /// <param name="row">Row to insert, required.</param>
        /// <exception cref="StorageException">
        /// If the row already exists throws this exception with <see cref="ErrorCode.DuplicateKey"/>
        /// </exception>
        public static async Task InsertAsync(this ITableStorage storage, string tableName, TableRow row)
        {
            if (row == null)
            {
                throw new ArgumentNullException(nameof(row));
            }

            await storage.InsertAsync(tableName, new[] { row });
        }
示例#32
0
        public ContentWriter(ITableStorage tableStorage, ILinkReader linkReader, IContentReader contentReader, IDataUpdater dataUpdater)
        {
            _contentReader = contentReader;
            _linkReader    = linkReader;
            _dataUpdater   = dataUpdater;

            _linkTable = tableStorage.TableClient.GetTableReference(Constants.LINKS_TABLE);
            _linkTable.CreateIfNotExistsAsync();
            _contentTable = tableStorage.TableClient.GetTableReference(Constants.CONTENT_TABLE);
            _contentTable.CreateIfNotExistsAsync();
        }
        /// <summary>
        /// Initializes a new instance of the MobileServiceTable class.
        /// </summary>
        /// <param name="tableName">
        /// The name of the table.
        /// </param>
        /// <param name="client">
        /// The <see cref="MobileServiceClient"/> associated with this table.
        /// </param>
        /// <param name="storageContext">
        /// The <see cref="ITableStorage"/> implementation to use with this table.
        /// </param>
        public MobileServiceTable(string tableName, MobileServiceClient client, ITableStorage storageContext)
        {
            Debug.Assert(tableName != null);
            Debug.Assert(client != null);
            Debug.Assert(storageContext != null);

            this.TableName = tableName;
            this.MobileServiceClient = client;
            this.StorageContext = storageContext;
            this.SystemProperties = MobileServiceSystemProperties.None;
        }
示例#34
0
        public static T Get <T>(this ITableStorage storage, string tableName, string partitionKey, string rowKey) where T : class, new()
        {
            TableRow row = storage.Get(tableName, partitionKey, rowKey);

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

            return(converter.Convert <T>(row));
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="CognitiveService"/> class.
        /// </summary>
        /// <param name="faceClient">The faceClient<see cref="IFaceClient"/>.</param>
        /// <param name="azureBlobService">The azureBlobService<see cref="IAzureBlobService"/>.</param>
        /// <param name="tableStorage">The tableStorage<see cref="ITableStorage"/>.</param>
        /// <param name="studentService">The studentService<see cref="IStudentService"/>.</param>
        public CognitiveService(IFaceClient faceClient, IAzureBlobService azureBlobService, ITableStorage tableStorage, IStudentService studentService)
        {
            _faceClient       = faceClient;
            _azureBlobService = azureBlobService;
            _tableStorage     = tableStorage;
            _studentService   = studentService;

            if (Uri.IsWellFormedUriString(SettingConfigurations.CognitiveServiceEndPoint, UriKind.Absolute))
            {
                faceClient.Endpoint = SettingConfigurations.CognitiveServiceEndPoint;
            }
        }
示例#36
0
        /// <summary>
        /// Constructor for Mocking
        /// </summary>
        /// <param name="storage">Storage</param>
        /// <param name="period">Period</param>
        public Coordinator(ITableStorage storage, TimeSpan period)
        {
            if (null == storage)
            {
                throw new ArgumentNullException("storage");
            }
            if (TimeSpan.Zero >= period)
            {
                throw new ArgumentException("period");
            }

            this.period = period;
            this.retryInterval = TimeSpan.FromSeconds(period.TotalSeconds * 2.5);
            this.storage = storage;
        }
 public TableStorageTests()
 {
     tableStorage = new TableStorage<TestTableEntity>(TableName, ConnectionString);
 }