public UbisoftRepository(IOptions <UbisoftConfig> config, ILogger <UbisoftRepository> log, INoSqlProvider db) { _log = log; _config = config.Value; _db = db; _source = new CancellationTokenSource(); _token = _source.Token; }
/// <summary> /// 获取MongoDB的集合对象 /// </summary> /// <typeparam name="DbModel">关联的实体对象信息</typeparam> /// <param name="tableName">表名称</param> /// <returns>存在返回集合对象;否则返回null</returns> public static IMongoCollection <DbModel> GetMongoCollection <DbModel>(String tableName) where DbModel : NoSqlBaseModel { INoSqlProvider provider = NoSqlManager.Create(Common.Utils.Const.AppCode); IMongoCollection <DbModel> collection = provider.GetCollection <DbModel, IMongoCollection <DbModel> >(tableName); if (collection == null) { throw new SystemException(String.Format("获取信息登记模型MongoDB集合失败。CollectionName:{0}", tableName)); } return(collection); }
/// <summary> /// 获取MongoDB的集合对象 /// </summary> /// <param name="tableName">表名称</param> /// <returns>存在返回集合对象;否则返回null</returns> public static IMongoCollection <BsonDocument> GetMongoCollectionForNoType(String tableName) { INoSqlProvider provider = NoSqlManager.Create(Common.Utils.Const.AppCode); IMongoCollection <BsonDocument> collection = provider.GetCollection <BsonDocument, IMongoCollection <BsonDocument> >(tableName); if (collection == null) { throw new SystemException(String.Format("获取信息登记模型MongoDB集合失败。CollectionName:{0}", tableName)); } return(collection); }
public void Execute() { ForegroundColor = Yellow; WriteLine("Creating initial conditions...\n"); using (ILifetimeScope scope = Container.BeginLifetimeScope()) { INoSqlProvider storageProvider = scope.Resolve <INoSqlProvider>(); Stack <Migration> migrations = new Stack <Migration> ( new[] { new AddGalaxyMigration(storageProvider) } ); Write("Running migrations..."); Stack <Migration> history = new Stack <Migration>(); try { while (migrations.Count > 0) { Migration migration = migrations.Pop(); ForegroundColor = Cyan; Write($"\n\tRunning {migration.GetType().Name} ... "); try { Do(history, migration); } catch (Exception e) { Undo(history, e); } } } catch (Exception) { WriteLine("Fatal error. Please re-install application."); throw; } } ForegroundColor = Green; WriteLine("\nFinished. "); ResetColor(); }
public void Execute() { ForegroundColor = Yellow; WriteLine($"\n Creating database weather forecast for {_years / 365} day(s)...\n"); using (ILifetimeScope scope = Program.Container.BeginLifetimeScope()) { IWeatherConditionsService weatherConditions = scope.Resolve <IWeatherConditionsService>(); INoSqlProvider provider = scope.Resolve <INoSqlProvider>(); WeatherForecast forecast = weatherConditions.GetWeatherForecast(_years); List <DaysSummaryDto> summaryDto = forecast.Days.Select(Mapper.Map <DaysSummaryDto>).ToList(); provider.Add("Forecast", summaryDto); } ForegroundColor = Green; WriteLine("Done. "); ResetColor(); }
public TicketProvider(INoSqlProvider provider) { _provider = provider; _source = new CancellationTokenSource(); _token = _source.Token; }
public NoSqlGalaxyRepository(INoSqlProvider storageProvider) { _storageProvider = storageProvider; }
public AddGalaxyMigration(INoSqlProvider storageProvider) { _storageProvider = storageProvider; }
public NoSqlWeatherRepository(INoSqlProvider noSqlProvider) { _noSqlProvider = noSqlProvider; }