public BlogSyncConfiguration( IBlogSource blogSource, IDataStorage dataStorage, IBlogPostBlavenIdProvider blavenIdProvider = null, IBlogPostUrlSlugProvider slugProvider = null, BlogTransformersProvider transformersProvider = null, IEnumerable<BlogSetting> blogSettings = null) { if (blogSource == null) { throw new ArgumentNullException(nameof(blogSource)); } if (dataStorage == null) { throw new ArgumentNullException(nameof(dataStorage)); } this.BlogSource = blogSource; this.DataStorage = dataStorage; this.BlavenIdProvider = blavenIdProvider ?? BlogSyncConfigurationDefaults.BlavenIdProvider; this.SlugProvider = slugProvider ?? BlogSyncConfigurationDefaults.SlugProvider; this.TransformersProvider = transformersProvider ?? BlogSyncConfigurationDefaults.TransformersProvider; this.BlogSettings = (blogSettings ?? new BlogSetting[0]).Where(x => x.BlogKey != null).ToList(); }
public NANCYRestModule(IDataStorage dataStorage, ILogger logger, IRamlDocument ramlDoc) { this.dataStorage = dataStorage; this.logger = logger; this.ramlDoc = ramlDoc; //selecting only Post without parameter as the last element of the path (i.e. /movies ) //selecting Get, Put and Delete with a parameter (some kind of id) as the as last element of the path (i.e. /movies/{id} ) var requests = from r in ramlDoc.RamlResources from m in r.RamlMethods where (m.Verb == "post" && r.Path.Last() != '}') || (m.Verb == "put" || m.Verb == "delete" || m.Verb == "get") && r.Path.Last() == '}' select new RequestDetails(r, m); foreach (var request in requests) { switch (request.Verb) { case "post": Post[request.Path] = param => processRequest(param, request, new Func<DataModel, DataModel>(dataStorage.Insert), new Func<DataModel, RequestDetails, Response>(processResp)); break; case "get": Get[request.Path] = param => processRequest(param, request, new Func<DataModel, DataModel>(dataStorage.Get), new Func<DataModel, RequestDetails, Response>(processResp)); break; case "put": Put[request.Path] = param => processRequest(param, request, new Func<DataModel, DataModel>(dataStorage.Update), new Func<DataModel, RequestDetails, Response>(processResp)); break; case "delete": Delete[request.Path] = param => processRequest(param, request, new Func<DataModel, DataModel>(dataStorage.Delete), new Func<DataModel, RequestDetails, Response>(processResp)); break; } } }
public DataViewModel(IMvxMessenger hub, IDataStorage<DataSample> data) { this.hub = hub; this.data = data; this.mvxSubscriptionToken = hub.Subscribe<NewDataMessage>(a => this.RaisePropertyChanged(() => this.DataList)); }
private static BlogSyncConfiguration GetTestBlogSyncConfiguration( IBlogSource blogSource = null, IDataStorage dataStorage = null) { var config = new BlogSyncConfiguration(blogSource, dataStorage, null, null, null, null); return config; }
public static void ProvideTestData(IDataStorage dataStorage) { var records = new List<ScoreRecord> () { new ScoreRecord { GameName = "game1", PlayerName = "player1", Score = 5000 }, new ScoreRecord { GameName = "game2", PlayerName = "player1", Score = 4000 }, new ScoreRecord { GameName = "game3", PlayerName = "player1", Score = 6000 }, new ScoreRecord { GameName = "game3", PlayerName = "player1", Score = 3000 }, new ScoreRecord { GameName = "game1", PlayerName = "player1", Score = 8000 }, new ScoreRecord { GameName = "game1", PlayerName = "player1", Score = 7000 }, new ScoreRecord { GameName = "game1", PlayerName = "player1", Score = 9000 }, new ScoreRecord { GameName = "game1", PlayerName = "player1", Score = 8000 }, new ScoreRecord { GameName = "game1", PlayerName = "player1", Score = 4000 }, new ScoreRecord { GameName = "game1", PlayerName = "player1", Score = 7000 }, new ScoreRecord { GameName = "game1", PlayerName = "player1", Score = 8000 }, new ScoreRecord { GameName = "game1", PlayerName = "player1", Score = 8000 }, new ScoreRecord { GameName = "game1", PlayerName = "player1", Score = 9000 }, new ScoreRecord { GameName = "game1", PlayerName = "player2", Score = 11000 }, new ScoreRecord { GameName = "game1", PlayerName = "player3", Score = 1000 }, }; foreach (var record in records) { dataStorage.AddScoreRecordToStorage(record); } }
public TestDataStorageProfiler () { m_mockLogger = new Mock<ILog> (); var storageMock = new Mock<IDataStorage> (); storageMock.Setup (m => m.GetAllScoresForGame ("game1")).Returns (new List<ScoreRecord>() { new ScoreRecord {PlayerName = "player1"}}); m_mockDataStorage = storageMock.Object; }
public ProcessManager( ISettingsFactory settings, IDataStorageFactory storage ) { _storage = storage.Get<List<PasswordedDemonizedProcess>>(); var source = _storage.Load(path) ?? Enumerable.Empty<PasswordedDemonizedProcess>(); _processes = source.Select( a => MappingHelper.Instance.Map<PasswordedDemonizedProcess, InternalDemonizedProcess>( a ) ).ToDictionary( process => process.Id, process => process ); _settings = settings.Get(); }
public void WriteData(LogDataEntry logData, string dataSourceType) { var dsl = new DataSourceLoader(); dsl.SetDataSource(dataSourceType, LoggerApp.Instance.DIContiner); dataStorage = LoggerApp.Instance.DIContiner.Get<IDataStorage>(); dataStorage.WriteData(logData); }
public DbExecuteContext(IDataService dataService, IStatementSetting statement, IDataStorage dataStorage, IDbCommandWrap commandWrap, IDictionary parameters, IDictionary items) : base(items) { this.DataService = dataService; this.Statement = statement; this.DataStorage = dataStorage; this.CommandWrap = commandWrap; this.Parameters = parameters; }
public SubscriptionController( IDataStorage dataStorage, IReporting reporting) { this.dataStorage = dataStorage; this.reporting = reporting; this.userActivityLogger = new UserActivityLogger(this.reporting); }
public StorageManager() { #if SILVERLIGHT _storage = new SilverlightDataStorage(); #elif XNA _storage = new XNAClientStorage(); #else _storage = new NETClientStorage(); #endif }
public TestableLightInjectNancyBootstrapper(IDataStorage dataStorage) { if (dataStorage != null) { m_dataStorage = dataStorage; } else { m_dataStorage = new GameScoreBoardDataCache (); } }
public DataUpdateJob(IHistoricalDataBroker broker, IEmailService emailService, UpdateJobSettings settings = null, IDataStorage localStorage = null, IInstrumentSource instrumentManager = null) { _broker = broker; _emailService = emailService; _errors = new List<string>(); _pendingRequests = new List<HistoricalDataRequest>(); _settings = settings ?? GetSettings(); _localStorage = localStorage ?? DataStorageFactory.Get(); _instrumentManager = instrumentManager ?? new InstrumentManager(); }
public SubscribeDispatcher( ILogger <SubscribeDispatcher> logger, IOptions <CapOptions> options, IServiceProvider provider) { _provider = provider; _logger = logger; _options = options.Value; _dataStorage = _provider.GetService <IDataStorage>(); Invoker = _provider.GetService <ISubscribeInvoker>(); }
public static BlogSyncService Create( IBlogSource blogSource = null, IDataStorage dataStorage = null, IEnumerable<BlogSetting> blogSettings = null) { blogSource = blogSource ?? new FakeBlogSource(); dataStorage = dataStorage ?? new FakeDataStorage(); blogSettings = blogSettings ?? BlogSettingTestData.CreateCollection(); var service = new BlogSyncService(blogSource, dataStorage, blogSettings.ToArray()); return service; }
/// <summary> /// Initializes a new instance of the <see cref="LocalizationManager"/> class. /// </summary> /// <param name="dataStorage">The data storage.</param> /// <param name="eventAggregator">The event aggregator.</param> public LocalizationManager(IDataStorage dataStorage, IEventAggregator eventAggregator) { Guard.AgainstNullArgument("dataStorage", dataStorage); Guard.AgainstNullArgument("eventAggregator", eventAggregator); this._dataStorage = dataStorage; this._eventAggregator = eventAggregator; this._currentLanguageObservable = new ReplaySubject <CultureInfo>(1); this.LoadCurrentLanguage(); }
/// <summary> /// Constructor /// </summary> /// <param name="additionalDataSources">Optional. Pass any additional data sources (for testing purposes).</param> /// <param name="cfBroker">IContinuousFuturesBroker (for testing purposes).</param> public RealTimeDataBroker(IContinuousFuturesBroker cfBroker, IDataStorage localStorage, IEnumerable <IRealTimeDataSource> additionalDataSources = null) { if (cfBroker == null) { throw new ArgumentNullException("cfBroker"); } _connectionTimer = new Timer(10000); _connectionTimer.Elapsed += ConnectionTimerElapsed; _connectionTimer.Start(); DataSources = new ObservableDictionary <string, IRealTimeDataSource> { { "SIM", new RealTimeSim() }/*, * {"Interactive Brokers", new IB(Properties.Settings.Default.rtdClientIBID)}*/ }; if (additionalDataSources != null) { foreach (IRealTimeDataSource ds in additionalDataSources) { DataSources.Add(ds.Name, ds); } } //we need to set the appropriate event methods for every data source foreach (IRealTimeDataSource s in DataSources.Values) { s.DataReceived += RealTimeData; s.TickReceived += TickReceived; s.Disconnected += SourceDisconnects; s.Error += s_Error; } ActiveStreams = new ConcurrentNotifierBlockingList <RealTimeStreamInfo>(); _arrivedBars = new BlockingCollection <RealTimeDataEventArgs>(); StreamSubscribersCount = new Dictionary <RealTimeStreamInfo, int>(); _aliases = new Dictionary <int, List <int> >(); _pendingCFRealTimeRequests = new Dictionary <int, RealTimeDataRequest>(); _continuousFuturesIDMap = new Dictionary <int, int>(); _requests = new Dictionary <int, RealTimeDataRequest>(); _usedIDs = new List <int>(); //connect to our data sources TryConnect(); //local storage _localStorage = localStorage; //start up the continuous futures broker _cfBroker = cfBroker; _cfBroker.FoundFrontContract += _cfBroker_FoundFrontContract; }
public CustomList(IDataStorage dataStorage, UserInfo userInfo, ListPermission permission, String name) { this.dataStorage = dataStorage; this.OwnerId = userInfo.Id; this.Name = name; if (userInfo.RoleIds != null) { PermissionByRole.Add(userInfo.RoleIds.First(), permission); } Contents = new List <string>(); }
public AddressSpaceManager(IDataStorage storage) { dataStorage = storage; var folderName = DbEngineConfigurationSection.ConfigSection.FolderPath; pageIndexFileName = Path.Combine(folderName, "dbFile.pageIndex"); pageIndex = new PageIndex(File.Open(pageIndexFileName, FileMode.OpenOrCreate, FileAccess.ReadWrite)); if (pageIndex.EndOfPageIndex == 0) { pageIndex.IndexFileGrowth(); } }
public MessageSender( ILogger <MessageSender> logger, IServiceProvider serviceProvider) { _logger = logger; _serviceProvider = serviceProvider; _options = serviceProvider.GetService <IOptions <CapOptions> >(); _dataStorage = serviceProvider.GetService <IDataStorage>(); _serializer = serviceProvider.GetService <ISerializer>(); _transport = serviceProvider.GetService <ITransport>(); }
public async Task Different_Queries_Should_Be_Executed_Test() { var provider = Configure(); IDataStorage storage = provider.GetService <IDataStorage>(); var firstResult = await storage.Retrieve(new FirstTestQuery()); Assert.Equal(LOREM, firstResult); var secondResult = await storage.Retrieve(new SecondTestQuery()); Assert.Equal(IPSUM, secondResult); }
/// <summary> /// Save Settings object from Run-time Settings. /// </summary> /// /// <remarks> /// The resulting file will be written using the IDataStorage interface. /// </remarks> /// /// <param name="filename"> Filename of the file. </param> /// /// <returns> /// true if it succeeds, false if it fails. /// </returns> public Boolean SaveSettings(String filename) { IDataStorage ds = getInterface <IDataStorage>(); if (ds != null && hasSettings) { ds.Save(filename, SettingsToXml()); return(true); } return(false); }
public TelegramManager(IDataStorage dataStorage, ILogger logger) : base(dataStorage, logger) { this._telegramBotToken = Environment.GetEnvironmentVariable("TELEGRAM_BOT_TOKEN"); if (string.IsNullOrWhiteSpace(_telegramBotToken)) { throw new InvalidOperationException("Telegram Bot token was not specified. Please first create a bot and specify its token."); } _botClient = new TelegramBotClient(_telegramBotToken); _botClient.OnMessage += (_, e) => Bot_OnMessage(e); _botClient.StartReceiving(); }
public MessageSender( ILogger <MessageSender> logger, IOptions <CapOptions> options, IDataStorage dataStorage, ISerializer serializer, ITransport transport) { _options = options; _dataStorage = dataStorage; _serializer = serializer; _transport = transport; _logger = logger; }
public BotConfiguration(IDataStorage storage) { _dataStorage = storage; var botConfig = _dataStorage.RestoreObject <BotConfiguration>("Config/BotConfig"); Token = botConfig.Token; Prefix = botConfig.Prefix; LoggingChannelId = botConfig.LoggingChannelId; RegistrationChannelId = botConfig.RegistrationChannelId; AlumniRoleId = botConfig.AlumniRoleId; SchoolClasses = botConfig.SchoolClasses; }
private static async Task Main() { Unity.RegisterTypes(); Console.WriteLine("Hello, Discord!"); IDataStorage storage = Unity.Resolve <IDataStorage>(); Connection connection = Unity.Resolve <Connection>(); await connection.ConnectAsync(new DiscordBot4MeConfig { Token = storage.RestoreObject <string>("Config/BotToken") }); }
private async Task ProcessReceivedAsync(IDataStorage connection, ProcessingContext context) { context.ThrowIfStopping(); var messages = await GetSafelyAsync(connection.GetReceivedMessagesOfNeedRetry); foreach (var message in messages) { await _subscribeDispatcher.DispatchAsync(message, context.CancellationToken); await context.WaitAsync(_delay); } }
// ReSharper disable once ParameterOnlyUsedForPreconditionCheck.Local private void AllTablesRecordCount(IDataStorage dataStorage, int recordCount, bool existingCount) { if (existingCount) { var count = dataStorage.RecordCount; Assert.Equal(recordCount, count); } else { var count = dataStorage.GetDequeueCount(); Assert.Equal(recordCount, count); } }
public TestDataStorageProfiler() { m_mockLogger = new Mock <ILog> (); var storageMock = new Mock <IDataStorage> (); storageMock.Setup(m => m.GetAllScoresForGame("game1")).Returns(new List <ScoreRecord>() { new ScoreRecord { PlayerName = "player1" } }); m_mockDataStorage = storageMock.Object; }
private async Task ProcessPublishedAsync(IDataStorage connection, ProcessingContext context) { context.ThrowIfStopping(); var messages = await GetSafelyAsync(connection.GetPublishedMessagesOfNeedRetry); foreach (var message in messages) { await _messageSender.SendAsync(message); await context.WaitAsync(_delay); } }
public async Task Query_Should_Be_Executed_Multiple_Time_Test() { var provider = Configure(); IDataStorage storage = provider.GetService <IDataStorage>(); for (int i = 0; i < 3; ++i) { var result = await storage.Retrieve(new FirstTestQuery()); Assert.Equal(LOREM, result); } }
public PersistentContext(ISerializer serializer, IDataStorage dataStorage) { if (serializer == null) { throw new ArgumentNullException(nameof(serializer)); } if (dataStorage == null) { throw new ArgumentNullException(nameof(dataStorage)); } this.serializer = serializer; this.dataStorage = dataStorage; }
public Node( DataBinding dataBinding, IDataStorage dataStorage, INodes nodes, int nodeId, int nodeCount) { DataBinding = dataBinding; DataStorage = dataStorage; Nodes = nodes; NodeId = nodeId; NodeCount = nodeId; }
public StoringDataConsumer(IDataBus dataBus, IDataStorage dataStorage) { if (dataBus == null) { throw new ArgumentNullException("dataBus"); } if (dataStorage == null) { throw new ArgumentNullException("dataStorage"); } m_DataBus = dataBus; m_DataStorage = dataStorage; }
#pragma warning restore 0067, 0649 public override void OnEvent(ExecutionContext context) { IDataStorage data = GameContext.Instance.Player.SessionStorage; if (!data.HasKeyForInt(_key)) { data.Store(_key, _defaultValue); } int value = data.RecallInt(_key); data.Store(_key, value + _incrementAmount); }
public ConsumerRegister(ILogger <ConsumerRegister> logger, IServiceProvider serviceProvider) { _logger = logger; _serviceProvider = serviceProvider; _options = serviceProvider.GetService <IOptions <CapOptions> >().Value; _selector = serviceProvider.GetService <MethodMatcherCache>(); _consumerClientFactory = serviceProvider.GetService <IConsumerClientFactory>(); _dispatcher = serviceProvider.GetService <IDispatcher>(); _serializer = serviceProvider.GetService <ISerializer>(); _storage = serviceProvider.GetService <IDataStorage>(); _cts = new CancellationTokenSource(); }
/// <summary>Инициализирует и создаёт <see cref="CountryStatisticCounter"/>.</summary> /// <param name="imageStorageName">Путь к хранилищу изображений.</param> /// <param name="dataStorage">Хранилище данных.</param> public CountryStatisticCounter(string imageStorageName, IDataStorage dataStorage) { _imageStorageName = imageStorageName; if (!(dataStorage is CountryReportData)) { throw new ArgumentException("IDataStorage is not ReportData"); } DataStorage = dataStorage as CountryReportData; _imageLoader = new ImageLoader(); }
//delete data from selected instruments private void ClearDataBtn_ItemClick(object sender, RoutedEventArgs routedEventArgs) { IList selectedInstruments = InstrumentsGrid.SelectedItems; if (selectedInstruments.Count == 0) { return; } if (selectedInstruments.Count == 1) { var inst = (Instrument)selectedInstruments[0]; MessageBoxResult res = MessageBox.Show( string.Format("Are you sure you want to delete all data from {0} @ {1}?", inst.Symbol, inst.Datasource.Name), "Delete", MessageBoxButton.YesNo); if (res == MessageBoxResult.No) { return; } } else { MessageBoxResult res = MessageBox.Show( string.Format("Are you sure you want to delete all data from {0} instruments?", selectedInstruments.Count), "Delete", MessageBoxButton.YesNo); if (res == MessageBoxResult.No) { return; } } using (IDataStorage storage = DataStorageFactory.Get()) { //todo: remove dependency on local storage here, use client instead foreach (Instrument i in selectedInstruments) { try { storage.DeleteAllInstrumentData(i); } catch (Exception ex) { MessageBox.Show(ex.Message); } } } StatusBarLabel.Content = "Instrument data deleted"; }
public DataTicker(IDataStorage dataStorage, IDataBus dataBus) { if (dataStorage == null) { throw new ArgumentNullException("dataStorage"); } if (dataBus == null) { throw new ArgumentNullException("dataBus"); } m_DataStorage = dataStorage; m_Subscription = dataBus.Subscribe <TimedData>(notifyClients); m_HubContext = GlobalHost.ConnectionManager.GetHubContext <DataTickerHub>(); }
public JellyDatabase(string connectionString) { _dataStorage = new IoFileManager(connectionString); _dataStorage.Initialise(); _addressSpaceManager = new AddressSpaceManager(_dataStorage); var addressSpaceIndexAgent = _addressSpaceManager.CreateVirtualAddressSpaceAgent(AddressSpaceIndex.IndexRootId); _addressSpaceIndex = new AddressSpaceIndex(addressSpaceIndexAgent); foreach (var metaData in _addressSpaceIndex.MetaData) { var database = IntialiseDatabase(metaData.KeyType, metaData.IndexId, metaData.DataId); _databases[metaData.DatabaseName] = database; } }
protected async static Task <Array> FetchRawDataAsync(IDataStorage storage, DataDomain dataDomain, string variable) { Stopwatch dataRequestSw = Stopwatch.StartNew(); ts.TraceEvent(TraceEventType.Start, 2, "Extracting data from storage"); var data = await storage.GetDataAsync(variable, dataDomain.Origin, null, dataDomain.Shape); dataRequestSw.Stop(); long sizeMb = (data.Length * Marshal.SizeOf(data.GetType().GetElementType())) / 1024 / 1024; ts.TraceEvent(TraceEventType.Stop, 2, string.Format("Data extracted in {0}. {1}MB extracted", dataRequestSw.Elapsed, sizeMb)); return(data); }
/// <summary> /// 创建过期消息清理任务 /// </summary> /// <param name="timer"></param> /// <param name="storage"></param> /// <param name="initializer"></param> /// <param name="options"></param> /// <param name="serviceScopeFactory"></param> public AbpCapExpiresMessageCleanupBackgroundWorker( AbpAsyncTimer timer, IDataStorage storage, IStorageInitializer initializer, IOptions <AbpCAPEventBusOptions> options, IServiceScopeFactory serviceScopeFactory) : base(timer, serviceScopeFactory) { Storage = storage; Options = options.Value; Initializer = initializer; timer.Period = Options.CleanUpExpiresMessageInterval; }
public ActivityService( IDataStorage <Group> groupDataStorage, IDataStorage <Activity> activityDataStorage, IDataStorage <ActivityOccurrence> occurrencesDataStorage, IDispatcher dispatcher, IQueueDispatcher queueDispatcher) { _groupDataStorage = groupDataStorage; _activityDataStorage = activityDataStorage; _occurrencesDataStorage = occurrencesDataStorage; _dispatcher = dispatcher; _queueDispatcher = queueDispatcher; }
/// <summary> /// Method for storing a Motivation Model as XML in a file. /// </summary> /// <param name="fileId"> File-Id for storing the model. </param> /// <param name="mm"> The Motivation model to store. </param> internal void writeMMToFile(string fileId, MotivationModel mm) { IDataStorage ids = (IDataStorage)AssetManager.Instance.Bridge; if (ids != null) { log("Storing DomainModel to File."); ids.Save(fileId, mm.toXmlString()); } else { log("No IDataStorage - Bridge implemented!", Severity.Error); } }
public DataUpdateJob(IHistoricalDataBroker broker, IEmailService emailService, UpdateJobSettings settings, IDataStorage localStorage, IInstrumentSource instrumentManager) { if (settings == null) throw new ArgumentNullException("settings"); if (localStorage == null) throw new ArgumentNullException("localStorage"); if (instrumentManager == null) throw new ArgumentNullException("instrumentManager"); _broker = broker; _emailService = emailService; _errors = new List<string>(); _pendingRequests = new List<HistoricalDataRequest>(); _settings = settings; _localStorage = localStorage; _instrumentManager = instrumentManager; }
public void Init(IHttpApplication context) { Debug.WriteLine("AntiScrapeModule.Init"); using (var container = new UnityContainer()) { container.Configure(x => { x.AddRegistry<IoCRegistry>(); }); _storage = container.Resolve<IDataStorage>(); } context.BeginRequest += OnBeginRequest; context.PostMapRequestHandler += OnPostMapRequestHandler; _application = context; }
public HistoricalDataBroker(int port) { _listenPort = port; _dataStorage = new MySQLStorage(); DataSources = new Dictionary<string, IHistoricalDataSource> { { "Interactive Brokers", new IB(3) }, { "Yahoo", new Yahoo() }, { "ContinuousFuturesBroker", new ContinuousFuturesBroker() }, { "Quandl", new Quandl() } }; foreach (IHistoricalDataSource ds in DataSources.Values) { ds.Error += DatasourceError; ds.HistoricalDataArrived += ExternalHistoricalDataArrived; ds.Disconnected += SourceDisconnects; } _dataStorage.Error += DatasourceError; _dataStorage.HistoricalDataArrived += LocalStorageHistoricalDataArrived; _serverThread = new Thread(Server); _serverThread.Name = "HDB Thread"; _connectionTimer = new Timer(10000); _connectionTimer.Elapsed += ConnectionTimerElapsed; _connectionTimer.Start(); _requestToIdentityMap = new Dictionary<int, string>(); _originalRequests = new ConcurrentDictionary<int, HistoricalDataRequest>(); _subRequests = new ConcurrentDictionary<int, List<HistoricalDataRequest>>(); _dataQueue = new ConcurrentQueue<KeyValuePair<int, List<OHLCBar>>>(); TryConnect(); StartServer(); }
internal static BlogSyncConfiguration Create( IBlogSource blogSource, IDataStorage dataStorage, IEnumerable<BlogSetting> blogSettings) { if (blogSource == null) { throw new ArgumentNullException(nameof(blogSource)); } if (dataStorage == null) { throw new ArgumentNullException(nameof(dataStorage)); } var config = new BlogSyncConfiguration( blogSource, dataStorage, slugProvider: null, blavenIdProvider: null, transformersProvider: null, blogSettings: blogSettings); return config; }
/// <summary> /// Delete an instrument and all locally stored data. /// </summary> public static void RemoveInstrument(Instrument instrument, IDataStorage localStorage) { using (var entityContext = new MyDBContext()) { //hacking around the circular reference issue if (instrument.IsContinuousFuture) { entityContext.Instruments.Attach(instrument); var tmpCF = instrument.ContinuousFuture; instrument.ContinuousFuture = null; instrument.ContinuousFutureID = null; entityContext.SaveChanges(); entityContext.ContinuousFutures.Attach(tmpCF); entityContext.ContinuousFutures.Remove(tmpCF); entityContext.SaveChanges(); } entityContext.Instruments.Attach(instrument); entityContext.Instruments.Remove(instrument); entityContext.SaveChanges(); } localStorage.Connect(); localStorage.DeleteAllInstrumentData(instrument); }
private static IReadOnlyCollection<SPTerm> GetTermsColection(IDataStorage storage, String name) { var names = storage.Get<SPTerm>(name).ToList(); return new ReadOnlyCollection<SPTerm>(names); }
public ScoreboardModule(IDataStorage dataStorage, ICryptation cryptation, ILogFactory logger) : base("/api/v1") { StaticConfiguration.DisableErrorTraces = false; m_dataStorage = dataStorage; m_cryptation = cryptation; m_logger = logger.GetLogger(GetType()); Get["/ping"] = parameters => { var response = (Response)"pong"; response.StatusCode = HttpStatusCode.OK; return response; }; Post["/addScoreBoardData"] = parameters => { try { var scoreBoardData = this.Bind<ScoreRecord>(); int createdId = m_dataStorage.AddScoreRecordToStorage(scoreBoardData); var response = Response.AsJson(createdId); response.StatusCode = HttpStatusCode.Created; return response; } catch (Exception e) { m_logger.Error(e.Message, e); var response = (Response)e.ToString(); response.StatusCode = HttpStatusCode.BadRequest; return response; } }; Get["/gameScoreBoard"] = parameters => { string gameNameFromQuery = Request.Query["gameName"]; string numberOfRecords = Request.Query["count"]; int count; if (int.TryParse(numberOfRecords, out count)) { try { return Response.AsJson(m_dataStorage.GetScoresForGame(gameNameFromQuery, count)); } catch (Exception e) { m_logger.Error(e.Message, e); var response = (Response)e.ToString(); response.StatusCode = HttpStatusCode.BadRequest; return response; } } return Response.AsJson(m_dataStorage.GetAllScoresForGame(gameNameFromQuery)); }; Get["/countHigherScores"] = parameters => { string gameNameFromQuery = Request.Query["gameName"]; string scoreFromQuery = Request.Query["score"]; int count; if (int.TryParse(scoreFromQuery, out count)) { try { return Response.AsJson(m_dataStorage.CountHigherScores(gameNameFromQuery, count)); } catch (Exception e) { m_logger.Error(e.Message, e); var response = (Response)e.ToString(); response.StatusCode = HttpStatusCode.BadRequest; return response; } } return Response.AsJson(m_dataStorage.GetAllScoresForGame(gameNameFromQuery)); }; Get["/playerScoreBoard"] = parameters => { try { string playerNameFromQuery = Request.Query["playerName"]; return Response.AsJson(m_dataStorage.GetAllScoresForUsername(playerNameFromQuery)); } catch (Exception e) { m_logger.Error(e.Message, e); var response = (Response)e.ToString(); response.StatusCode = HttpStatusCode.BadRequest; return response; } }; Get["/gameNames"] = parameters => { try { return Response.AsJson(m_dataStorage.GetAllGameNames()); } catch (Exception e) { m_logger.Error(e.Message, e); var response = (Response)e.ToString(); response.StatusCode = HttpStatusCode.BadRequest; return response; } }; }
public NoteList(IDataStorage dataStorage) { _dataStorage = dataStorage; }
private static async Task SendRunStats(Options options, IDataStorage dataStorage, TimeSpan ellapsed, RunAllResult result, int chunkCount, CancellationToken cancellationToken) { var obj = new JObject(); obj["Cache"] = dataStorage.Name; obj["EllapsedSeconds"] = (int)ellapsed.TotalSeconds; obj["IsJenkins"] = Constants.IsJenkinsRun; obj["Is32Bit"] = !options.Test64; obj["AssemblyCount"] = options.Assemblies.Count; obj["CacheCount"] = result.CacheCount; obj["ChunkCount"] = chunkCount; obj["Succeeded"] = result.Succeeded; var request = new RestRequest("api/testrun", Method.POST); request.RequestFormat = DataFormat.Json; request.AddParameter("text/json", obj.ToString(), ParameterType.RequestBody); try { var client = new RestClient(Constants.DashboardUriString); var response = await client.ExecuteTaskAsync(request); if (response.StatusCode != System.Net.HttpStatusCode.NoContent) { Logger.Log($"Unable to send results: {response.ErrorMessage}"); } } catch { Logger.Log("Unable to send results"); } }
private TaskManager() { dataStorage = new XMLDataStorage (); dataStorage.LoadTasks (); }
public DataProxy( IDataStorage storage ) { this.storage = storage; }
public BlogEngineTests() { dataStorage = MockRepository.GenerateStub<IDataStorage>(); blogEngine = new BlogEngine(dataStorage); }
public DataLedger( IDataStorage storage ) { this.Storage = storage; }
public BlogEngine(IDataStorage dataStorage) { this.dataStorage = dataStorage; }
private static async Task SendRunStats(Options options, IDataStorage dataStorage, TimeSpan elapsed, RunAllResult result, int partitionCount, CancellationToken cancellationToken) { var testRunData = new TestRunData() { Cache = dataStorage.Name, ElapsedSeconds = (int)elapsed.TotalSeconds, IsJenkins = Constants.IsJenkinsRun, Is32Bit = !options.Test64, AssemblyCount = options.Assemblies.Count, ChunkCount = partitionCount, CacheCount = result.CacheCount, Succeeded = result.Succeeded }; var request = new RestRequest("api/testData/run", Method.POST); request.RequestFormat = DataFormat.Json; request.AddParameter("text/json", JsonConvert.SerializeObject(testRunData), ParameterType.RequestBody); try { var client = new RestClient(Constants.DashboardUriString); var response = await client.ExecuteTaskAsync(request); if (response.StatusCode != System.Net.HttpStatusCode.NoContent) { Logger.Log($"Unable to send results: {response.ErrorMessage}"); } } catch { Logger.Log("Unable to send results"); } }
internal CachingTestExecutor(Options options, ITestExecutor testExecutor, IDataStorage dataStorage) { _testExecutor = testExecutor; _dataStorage = dataStorage; _contentUtil = new ContentUtil(options); }