Ejemplo n.º 1
0
 public SubscriptionRepository(IMongoService mongoService,
                               IConfiguration configuration, IMapper mapper)
 {
     _mogoService    = mongoService;
     _mapper         = mapper;
     _collectionName = configuration["AppSettings:subscriptionCollection"];
 }
Ejemplo n.º 2
0
 public UserRepository(IMongoService mongoService,
                       IConfiguration configuration, IMapper mapper)
 {
     _mongoService   = mongoService;
     _mapper         = mapper;
     _collectionName = configuration["AppSettings:userCollection"];
 }
        private static string _returnArea = "";//缓存damagearea/area接口

        public DamageAnalysisService(IMongoService mongoService,
                                     ILogger <DamageAnalysisService> logger,
                                     IConfiguration configuration)
        {
            Configuration = configuration;

            _mongoService = mongoService ??
                            throw new ArgumentNullException(nameof(mongoService));


            this._logger = logger;

            _infos = _mongoService.GetInfos();
            //_configs = _mongoService.GetConfigs();


            _overlays = _mongoService.GetOverlays();
            foreach (var overlay in _overlays)
            {
                additionTable.Add(Damage2String(overlay.addend) + Damage2String(overlay.augend),
                                  Int32.Parse(Damage2String(overlay.result)));
            }

            //创建线程,并启动
            //Thread th = new Thread(new ThreadStart(ThreadMethod));
            //th.Start();

            task = new Task(Run, cts.Token, TaskCreationOptions.LongRunning);
            task.Start();
        }
Ejemplo n.º 4
0
 public SurveyRepository(IMongoService service,
                         IConfiguration configuration, IMapper mapper)
 {
     _service        = service;
     _mapper         = mapper;
     _collectionName = configuration["AppSettings:surveyCollection"];
 }
Ejemplo n.º 5
0
    public MongoStartupConfigTestBuilderPattern(MongoFixture fixture)
        : base(fixture)
    {
        var mongoFactory = fixture.Services.GetService <IMongoServiceFactory>();

        MongoService = mongoFactory.GetService(TestConstants.MongoDBKey);
    }
Ejemplo n.º 6
0
        public ScraperWorker(ILogger <ScraperWorker> logger, IMongoService mongoService, IConfiguration config)
        {
            _logger = logger;
            _config = config;

            _mongoService = mongoService;
        }
Ejemplo n.º 7
0
        public static async Task <List <T> > GetDataSample <T>(IMongoService <T> ms)
        {
            var file = $"{Startup.PATH}/Data/{typeof(T).Name}_SEED.json";

            if (File.Exists(file))
            {
                try {
                    var documents = JsonSerializer.Deserialize <List <T> >(File.ReadAllText(file));
                    // write
                    var data = await ms.GetDocumentsAsync();

                    if (data.ToList().Any() == false)
                    {
                        foreach (T document in documents)  // prevent others
                        {
                            await ms.AddDocumentAsync(document);
                        }
                    }
                    return(documents);
                }
                catch (Exception exception) {
                    Trace.WriteLine($"Exception: {exception.Message}");
                }
            }
            return(new List <T>());
        }
Ejemplo n.º 8
0
        public ReminderWorker(ILogger <ReminderWorker> logger, IMongoService mongoService, IConfiguration config)
        {
            _logger = logger;
            _config = config;

            _mongoService  = mongoService;
            _webhookClient = new DiscordWebhookClient(config.GetSection("Workers")["webhookUri"]);
        }
Ejemplo n.º 9
0
 public MongoServiceTest()
 {
     _mockDb         = new Mock <IMongoDatabase>();
     _mockClient     = new Mock <IMongoClient>();
     _mockCollection = new Mock <IMongoCollection <SurveyEntity> >();
     _mockClient.Setup(stub => stub.GetDatabase(It.IsAny <string>(), It.IsAny <MongoDatabaseSettings>())).Returns(_mockDb.Object);
     _mongoService = new MongoService("dataBase", _mockClient.Object);
 }
 public static Task <ReplaceOneResult> Upsert <T>(this IMongoService <T> service, T entity) where T : MongoEntity
 {
     return(service.Collection.ReplaceOneAsync(
                service.Filter.Eq(t => t.Id, entity.Id),
                entity,
                new ReplaceOptions {
         IsUpsert = true
     }));
 }
Ejemplo n.º 11
0
        protected SnatchProcessTemplate(ILogger <ScraperWorker> logger, IConfiguration config, IMongoService mongoService)
        {
            _logger        = logger;
            _config        = config;
            _mongoService  = mongoService;
            _webhookClient = new DiscordWebhookClient(config.GetSection("Workers")["webhookUri"]);

            _roleId = config.GetSection("Workers")["discordRoleId"];
        }
Ejemplo n.º 12
0
 public LoginService(
     ILog log,
     IMongoService dbService,
     IUserService uService,
     IFacebookService fService)
 {
     Log        = log;
     _dbService = dbService;
     _uService  = uService;
     _fService  = fService;
 }
Ejemplo n.º 13
0
        public TestService(IMongoService mongoService,
                           ILogger <TestService> logger,
                           IConfiguration configuration)
        {
            Configuration = configuration;

            _mongoService = mongoService ??
                            throw new ArgumentNullException(nameof(mongoService));


            this._logger = logger;
        }
Ejemplo n.º 14
0
 public ValuesController(ILogger <ValuesController> logger,
                         IHttpContextAccessor accessor,
                         IUserService userService,
                         IElasticService eService,
                         IMongoService mongoService)
 {
     _logger       = logger;
     _accessor     = accessor;
     _userService  = userService;
     _eService     = eService;
     _mongoService = mongoService;
 }
Ejemplo n.º 15
0
 public ClientService(IDirectoryDbSettings dbSettings, IMongoService mongoService)
 {
     clients = mongoService.GetCollection <ClientModel>(dbSettings.ClientCollectionName);
 }
Ejemplo n.º 16
0
 public UserController(IMongoService service)
 {
     _service = service;
 }
Ejemplo n.º 17
0
        public ClientUserController(IMongoService mongoService)
        {
            _mongoService = mongoService;

            _mongoService.PrincipalUser = User;
        }
Ejemplo n.º 18
0
 public HostedService(
     IMongoService mongoservice,
     IDamageAnalysisService damageService
     )
 {
 }
Ejemplo n.º 19
0
 public ProjectService(IConfiguration config, IMongoService agileHouse)
 {
     _projects = agileHouse.GetDatabase().GetCollection <AgileHouseProject> ("Project");
 }
Ejemplo n.º 20
0
 public AmazonProcess(ILogger <ScraperWorker> logger, IConfiguration config, IMongoService mongoService) : base(logger, config, mongoService)
 {
     _logger = logger;
 }
Ejemplo n.º 21
0
 public StoreRepository(IMongoService mongoDbService)
 {
     this.mongoDbService = mongoDbService;
 }
Ejemplo n.º 22
0
        public CategoryController(IMongoService mongoService)
        {
            categories = mongoService.Database.GetCollection<Category>("categories");
			books = mongoService.Database.GetCollection<Book>("books");
        }
Ejemplo n.º 23
0
 public QuizzesController(ISQLRepositoryManager manager, IMongoService mongo, IMapper mapper)
 {
     this.manager = manager;
     this.mongo   = mongo;
     this.mapper  = mapper;
 }
 public BalanceService(IMongoService service)
 {
     _service = service;
 }
Ejemplo n.º 25
0
 public BookController(IMongoService mongoService)
 {
     books = mongoService.Database.GetCollection<Book>("books");
     projection = Builders<Book>.Projection.Include("Name").Include("Pictures");
 }
Ejemplo n.º 26
0
 public BooksController(IMongoService <Book> bookService, IMapper mapper)
 {
     _bookService = bookService;
     _mapper      = mapper;
 }
Ejemplo n.º 27
0
 /// <summary>
 /// default controller
 /// </summary>
 public TestService(IMongoService mongo)
 {
     mongoService = mongo;
 }
 /// <summary>
 /// default controller
 /// There is no separate service for DateSet - seems like overkill.
 /// Web API converts C# returned types to aptly status-coded HttpResponseMessages wrapping the type.
 /// See: http://www.asp.net/web-api/overview/getting-started-with-aspnet-web-api/action-results
 /// </summary>
 public DateSetController(MongoService _repository)
 {
     repository = _repository;
 }
Ejemplo n.º 29
0
 /// <summary>
 /// default controller
 /// </summary>
 public TestController(IMongoService mongo, IBlobService blob, ITestService test)
 {
     mongoService = mongo;
     blobService = blob;
     testservice = test;
 }
 public UsersService(IMongoService mongoService)
 {
     _repository = mongoService.GetRepository <User>();
 }
Ejemplo n.º 31
0
 public MongoActor(IInjector injector)
 {
     _mongo = injector.Get <IMongoService>();
     Receive <UpsertMessage>(SaveEntity);
 }
Ejemplo n.º 32
0
 public ArtistActor(IInjector injector)
 {
     _mongo = injector.Get <IMongoService>();
     Receive <Artist>(OnArtist);
 }
 protected virtual void SetMongoService(IMongoService service)
 {
     ConsoleOutput.Write(GetType(), ConsoleMessage.Create(""));
     _mongoService = service;
 }
Ejemplo n.º 34
0
 public CartController(IMongoService mongoService, IRedisService redisService)
 {
     this.books = mongoService.Database.GetCollection<Book>("books");
     this.redisDb = redisService.Database;
 }
Ejemplo n.º 35
0
 public OrderStorage()
 {
     mongoService = DependencyService.Get <IMongoService>();
 }
Ejemplo n.º 36
0
        public SystemEventsController(IMongoService mongoService)
        {
            _mongoService = mongoService;

            _mongoService.PrincipalUser = User;
        }
 /// <summary>
 /// default controller
 /// </summary>
 public InputDataController(MongoService _repository)
 {
     repository = _repository;
 }