Example #1
0
 public DispatcherBase(IMongoRepository mongoRepository, IGESConnection gesConnection, List<IHandler> eventHandlers)
 {
     _mongoRepository = mongoRepository;
     _gesConnection = gesConnection.BuildConnection();
     _gesConnection.ConnectAsync();
     _eventHandlers = eventHandlers;
     // add all handlers to the broadcast block so they receive news of events
     RegisterHandlers();
     // gets last event processed to avoid re processing events after a shut down.
     GetLastEventProcessedForHandlers();
 }
Example #2
0
 public CommandDispatcher(IMongoRepository mongoRepository, IGESConnection gesConnection, List<IHandler> eventHandlers) 
     : base(mongoRepository, gesConnection, eventHandlers)
 {
     _targetClrTypeName = "CommandClrTypeName";
     _eventFilter = x =>
         {
             if (x.OriginalEvent.Metadata.Length <= 0 || x.OriginalEvent.Data.Length <= 0)
             { return false; }
             var jProperty = Newtonsoft.Json.Linq.JObject.Parse(Encoding.UTF8.GetString(x.Event.Metadata)).Property(_targetClrTypeName);
             return !x.Event.EventType.StartsWith("$") && jProperty!=null && jProperty.HasValues;
         };
 }
		private bool UpdateTagsInPost(IMongoRepository<Post> repo, Post post)
		{
			var tags = ComputeTagsFromBody(post.Body);

			// COMPARE AND SWAP (CAS)
			// - Compare the body text to make sure its not stale
			// - Swap in the freshly computed tags
			return repo.Update(Query.And(
									Query.EQ("_id", post.Id),
									Query.EQ(Post.FN_BODY, post.Body)
							   ),
			                   Update.AddToSetEachWrapped(Post.FN_TAGS, tags),
			                   UpdateFlags.None);
		}
Example #4
0
 public HandlerBase(IMongoRepository mongoRepository)
 {
     _mongoRepository = mongoRepository;
 }
Example #5
0
 public BaseController(IBioInformatixService _bioService = null, IMongoRepository _db = null)
 {
     bioService = _bioService ?? DependencyResolver.Current.GetService <IBioInformatixService>();
     db         = _db ?? DependencyResolver.Current.GetService <IMongoRepository>();
 }
Example #6
0
 public BaseController(IMongoRepository <T> rep)
 {
     Rep = rep;
 }
Example #7
0
 public SocialRepositoryTests()
 {
     _socialRepo = new MongoRepository <Social>(_url, CollectionNames.SocialCollection);
 }
Example #8
0
 /// <summary>
 /// Constructs a new instance of <see cref="UserOnlyStore{TUser}"/>.
 /// </summary>
 /// <param name="context">The <see cref="DbContext"/>.</param>
 /// <param name="describer">The <see cref="IdentityErrorDescriber"/>.</param>
 public UserOnlyStore(IMongoRepository <AspNetdentityMongoContext> context, IdentityErrorDescriber describer = null) : base(context, describer)
 {
 }
Example #9
0
 public UpdateElectricMetterHandler(IMongoRepository <ElectricMetter> repository, ILoggerManager logger)
 {
     _repository = repository;
     _logger     = logger;
 }
        private static void RemoveSessionStateStoreData(IMongoRepository repository, string id) {
            id.ShouldNotBeWhiteSpace("id");

            if(IsDebugEnabled)
                log.Debug("세션 정보를 삭제합니다... session id=[{0}]", id);

            var removed = repository.RemoveByIdAs<MongoSessionStateEntry>(id);

            if(IsDebugEnabled)
                log.Debug("세션 정보를 삭제했습니다!!! session id=[{0}], 삭제 여부=[{1}]", id, removed.Ok);

            With.TryAction(() => RemoveExpires(repository));
        }
Example #11
0
 public GetTicketQueryHandler(IMongoRepository <Ticket> ticketServices, IMapper mapper, ICurrentUserService currentUserService)
 {
     _ticketServices     = ticketServices;
     _mapper             = mapper;
     _currentUserService = currentUserService;
 }
Example #12
0
 public DocoUserService(IMongoRepository<DocoUser> docoDb)
 {
     _docoDb = docoDb;
 }
 public HashTagsController(IMongoRepository<HashTag> repository)
 {
     _repository = repository;
 }
 public EncodeInterface(IMongoRepository mongoRepository)
 {
     
 }
        public ActionResult Success()
        {
            Logger.Debug("Success Called");

            var twitterResponse = (ITwitterResponse)TempData["twitterResponse"];
            if (twitterResponse != null)
            {
                _userRepository = Container.Windsor.Resolve<IMongoRepository<User>>();
                var existing = _userRepository.Linq().FirstOrDefault(x => x.AccessSecret == twitterResponse.AccessSecret);
                if(existing==null)
                {
                    //add user to database.
                    var oauthTokens = new OAuthTokens
                    {
                        AccessToken = twitterResponse.AccessToken,
                        AccessTokenSecret = twitterResponse.AccessSecret,
                        ConsumerKey = ConsumerKey,
                        ConsumerSecret = ConsumerSecret
                    };
                    TwitterResponse<TwitterUser> response = TwitterUser.Show(oauthTokens, twitterResponse.Logon);
                     if (response.Result == RequestResult.Success)
                     {
                         var details = response.ResponseObject;
                         var user = new User()
                         {
                             TwitterId = details.Id.ToString(),
                             Logon = details.ScreenName,
                             Name = details.Name,
                             Location = details.Location,
                             AccessSecret = twitterResponse.AccessSecret,
                             AccessToken = twitterResponse.AccessToken,
                             IsActive = true,
                             ProfileImage = details.ProfileImageLocation
                         };
                         _userRepository.Save(user);
                     }

                }
                else
                {
                    //user exists. yay.
                }
            }
            return Redirect("~/");
        }
Example #16
0
 public UserClient(IMongoRepository<User> dbRepo)
 {
     this.dbRepo = dbRepo;
 }
Example #17
0
 public MongoMessageOutbox(IMongoRepository <OutboxMessage, Guid> repository)
 => _repository = repository;
Example #18
0
 public ActivitiyLogService(IMongoRepository<ActivityLog> mongoDb )
 {
     _mongoDb = mongoDb;
 }
Example #19
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="repository"></param>
 protected GenericCrudService(IMongoRepository <TDto> repository)
 {
     this.repository = repository;
 }
Example #20
0
 public DataGateway(IMongoRepository<HashTag> hashTagRepository, IMongoRepository<ProcessedLink> processedLinkRepository )
 {
     _hashTagRepository = hashTagRepository;
     _processedLinkRepository = processedLinkRepository;
 }
Example #21
0
 public TestId4ForMongodb()
 {
     mongoRepository = services.BuildServiceProvider().GetRequiredService <IMongoRepository <TestMongoContext> >();
 }
Example #22
0
 public UserHandler(IMongoRepository mongoRepository) : base(mongoRepository)
 {
     _mongoRepository = mongoRepository;
     _handlerType = "UserHandler";
     _lastProcessedPosition = new LastProcessedPosition();
 }
Example #23
0
 public HomeController(IMongoRepository<ProcessedLink> repository, IMongoRepository<HashTag> hashTagRepository)
 {
     _repository = repository;
     _hashTagRepository = hashTagRepository;
 }
 public LoginUserMessageBinder(IMongoRepository mongoRepository, IEventStoreConnection eventStoreConnection)
     : base(eventStoreConnection)
 {
     _mongoRepository = mongoRepository;
 }
        private static SessionStateStoreData LoadSessionStateStoreData(HttpContext context, IMongoRepository repository, string id,
                                                                       TimeSpan sessionTimeout) {
            if(IsDebugEnabled)
                log.Debug("세션 정보를 캐시에서 로드합니다... id=[{0}]", id);

            With.TryAction(() => RemoveExpires(repository));

            try {
                SessionStateItemCollection itemCollection = null;

                var entry = repository.FindOneByIdAs<MongoSessionStateEntry>(id);
                if(entry != null && entry.State != null) {
                    itemCollection = WebTool.DeserializeSessionState(entry.State);

                    if(IsDebugEnabled)
                        log.Debug("세션 정보를 캐시에서 로드했습니다!!! id=[{0}]", id);
                }

                return new SessionStateStoreData(itemCollection ?? new SessionStateItemCollection(),
                                                 SessionStateUtility.GetSessionStaticObjects(context),
                                                 (int)sessionTimeout.TotalMinutes);
            }
            catch(Exception ex) {
                if(log.IsWarnEnabled) {
                    log.Warn("MongDB에서 세션 정보를 로드하는데 실패했습니다. id=[{0}]", id);
                    log.Warn(ex);
                }
            }
            return null;
        }
Example #26
0
 public UploadImageRequestHandler(IImageResizer imageResizer, IAzureStorageRepository azureStorageRepository, IMongoRepository mongoRepository, IWebHostEnvironment environment)
 {
     _imageResizer           = imageResizer;
     _azureStorageRepository = azureStorageRepository;
     _mongoRepository        = mongoRepository;
     _environment            = environment;
 }
Example #27
0
 public GetResourceHandler(IMongoRepository <ResourceDocument, Guid> repository)
 => _repository = repository;
 public SprintRepository(IMongoRepository <SprintDocument, string> repository)
 {
     _repository = repository;
 }
Example #29
0
 public LinksController(IMongoRepository<ProcessedLink> repository)
 {
     _repository = repository;
 }
        private static void RemoveExpires(IMongoRepository repository) {
            repository.ShouldNotBeNull("repository");

            var query = Query.LTE("UtcExpiry", DateTime.UtcNow.ToMongoDateTime());
            Task.Factory.StartNew(() => With.TryAction(() => repository.Remove(query)),
                                  TaskCreationOptions.LongRunning);
        }
 public GetEmployeeHandler(IMongoRepository <EmployeeDocument, Guid> repository, ILogger <GetEmployeeHandler> logger)
 {
     _repository = repository;
     _logger     = logger;
 }
 public PlayerDetailsController(IMongoRepository repository)
 {
     _repository = repository;
 }
 public LibreriaAutorController(IMongoRepository <AutorEntity> autorGenericoRepository)
 {
     _autorGenericoRepository = autorGenericoRepository;
 }
Example #34
0
 public CustomerMongoRepository(IMongoRepository <CustomerDocument, Guid> repository)
 {
     _repository = repository;
 }
 public GetOrderHandler(IMongoRepository <Order, Guid> repository)
 {
     _repository = repository;
 }
Example #36
0
 public GetDiscountHandler(IMongoRepository <Discount> discountsRepository,
                           IMongoRepository <Customer> customersRepository)
 {
     _discountsRepository = discountsRepository;
     _customersRepository = customersRepository;
 }
Example #37
0
 public AccountRepository(IMongoRepository <Account> collection)
 {
     _collection = collection;
 }
Example #38
0
 public Repository(IMongoRepository <T> mongoRepository)
 {
     _mongoRepository = mongoRepository;
 }
Example #39
0
 public ParcelMongoRepository(IMongoRepository <ParcelDocument, Guid> repository)
 {
     _repository = repository;
 }
Example #40
0
 public GetContractQueryHandler(IMongoRepository <Contract> contractRepository, IMapper mapper)
 {
     _contractRepository = contractRepository;
     _mapper             = mapper;
 }
 public ErrorRepository(IMongoRepository mongoRepository, string errorCollectionName)
 {
     _errorCollection = mongoRepository.Database.GetCollection <Error>(errorCollectionName);
 }
Example #42
0
 public FollowerRepository(IMongoRepository <FollowerDocument, Guid> repository)
 {
     _repository = repository;
 }
 /// <summary>
 /// Инициализирует новый экземпляр класса <see cref="PlayersController"/>.
 /// </summary>
 /// <param name="mongoRepository">Хранилище.</param>
 public PlayersController(IMongoRepository mongoRepository)
 {
     _mongoRepository = mongoRepository;
 }
 public OrdersRepository(IMongoRepository <Order> repository)
 => _repository = repository;
Example #45
0
 public GetTaskByIdFunc(
     IMongoRepository <TaskEntity> taskRepository)
 {
     this.taskRepository = taskRepository;
 }
 public UserRepository(IMongoRepository <UserDocument, Guid> repository)
 {
     _repository = repository;
 }
 public CreateCategoryCommandHandler(IMongoRepository <ToolsCategory> toolCategoryRepository, IMapper mapper)
 {
     _toolCategoryRepository = toolCategoryRepository;
     _mapper = mapper;
 }
 public FederationsRepository(IMongoRepository <SportFederation> repository)
 {
     _repository = repository;
 }
 public RegisterUserWorkflow(IGetEventStoreRepository getEventStoreRepository, IMongoRepository mongoRepository)
     : base(mongoRepository)
 {
     _getEventStoreRepository = getEventStoreRepository;
     _handlerType = "RegisterUserWorkflow";
 }
        private static void SaveSessionStateStoreData(HttpContext context, IMongoRepository repository, string id,
                                                      SessionStateStoreData sessionStateStoreData, TimeSpan sessionTimeout) {
            if(IsDebugEnabled)
                log.Debug("세션 정보를 캐시에 저장합니다... id=[{0}], sessionTimeout=[{1}]", id, sessionTimeout);

            With.TryAction(() => RemoveExpires(repository));

            try {
                byte[] cacheItem = null;

                // NOTE: SessionStateItemCollection 자체적으로 제공하는 Serialize/Deserialize를 사용해야 합니다. 
                //       SessionStateItemCollection 은 SerializableAttribte 가 정의되어 있지 않아 일반적인 방식으로는 직렬화를 수행할 수 없습니다.
                //
                if(sessionStateStoreData != null && sessionStateStoreData.Items != null)
                    cacheItem = WebTool.SerializeSessionState((SessionStateItemCollection)sessionStateStoreData.Items);

                var result = repository.Save(new MongoSessionStateEntry(id, cacheItem, DateTime.UtcNow.Add(sessionTimeout)));

                if(IsDebugEnabled)
                    log.Debug("세션 정보를 캐시에 저장했습니다!!! id=[{0}], 저장결과=[{1}], sessionTimeout=[{2}]", id, result.Ok, sessionTimeout);
            }
            catch(Exception ex) {
                if(log.IsErrorEnabled) {
                    log.Error("캐시에 세션 정보를 저장하는데 실패했습니다. id=[{0}]", id);
                    log.Error(ex);
                }
            }
        }