public LocalDBContext( IEntitiesRepository entitiesRepository, ILogger logger = null) { Logger = logger; this.entitiesRepository = entitiesRepository; }
public ProjectModel GetProjectByProjectName(string projectName) { using (_repository = _getRepository()) { return _repository.Get(item => item.Name.Equals(projectName)).First(); } }
public CategoryModel Get(int id) { using (_repository = _getRepository()) { return _repository.Get(id); } }
public IEnumerable<UserModel> GetAll() { using (_repository = _getRepository()) { return _repository.Get(item => item.webpages_Roles).ToArray(); } }
public IEnumerable<PriorityModel> GetAll() { using (_repository = _getRepository()) { return _repository.Get().ToArray(); } }
public UserModel GetByUserName(string userName) { using (_repository = _getRepository()) { return _repository.Get(item => item.UserName.Equals(userName), item => item.webpages_Roles).First(); } }
public UserModel GetById(int id) { using (_repository = _getRepository()) { return _repository.Get(item => item.UserId == id, item => item.webpages_Roles).First(); } }
public StatusModel Get(int id) { using (_repository = _getRepository()) { return _repository.Get(id); } }
public RoleModel GetById(int id) { using (_repository = _getRepository()) { return _repository.Get(id); } }
public ClusterMonitorService( IServiceProvider sp, IClusterRequestHandler _node, IEntitiesRepository entitiesRepository, MetricManagementService metricManagementService, IMetricTicksRepository metricTicksRepository, IDatabaseMetricsCollector databaseMetricsCollector, NodeStateService nodeStateService, IOptions <ClusterOptions> clusterOptions) { _metricManagementService = metricManagementService; // var sp = serviceProvider.CreateScope().ServiceProvider; _mediator = sp.GetService <IMediator>(); _logger = sp.GetService <ILogger <ClusterMonitorService> >(); _state = sp.GetService <IClusterStateService>(); _logger.LogInformation("Starting clean up service..."); node = _node; _entitiesRepository = entitiesRepository; _metricTicksRepository = metricTicksRepository; _databaseMetricsCollector = databaseMetricsCollector; monitoringTimer = new System.Threading.Timer(CollectMetricsEventHandler); node.MetricGenerated += metricGenerated; _nodeStateService = nodeStateService; _clusterOptions = clusterOptions; Start(); }
public TaskModel GetTaskByTaskName(string taskName) { using (_repository = _getRepository()) { return _repository.Get(item => item.Name.Equals(taskName)).First(); } }
public PriorityModel Get(int id) { using (_repository = _getRepository()) { return _repository.Get(id); } }
public DataController( IEntitiesRepository entitiesRepository, DbContext dbContext) { this.entitiesRepository = entitiesRepository; this.dbContext = dbContext; }
public Models.UserProfile GetUserProfileByUserName(string name) { using (_userProfileRepository = _userProfileRepositoryInitializer()) { return Mapper.Map<UserProfile, Models.UserProfile>(_userProfileRepository.Get(u => u.UserName.Equals(name)).SingleOrDefault()); } }
public GetMetricsQueryHandler(ILogger <GetMetricsQueryHandler> logger, IEntitiesRepository entitiesRepository, IMetricTicksRepository metricTicksRepository) { _entitiesRepository = entitiesRepository; _metricTicksRepository = metricTicksRepository; _logger = logger; }
public void Create(ProjectModel project) { using (_repository = _getRepository()) { _repository.Insert(project); _repository.Save(); } }
public void Create(SlotModel slot) { using (_repository = _getRepository()) { _repository.Insert(slot); _repository.Save(); } }
public void UpdateMembership(Models.webpages_Membership toUpdate) { using (_membershipRepository = _membershipRepositoryInitializer()) { _membershipRepository.Update(Mapper.Map<Models.webpages_Membership, webpages_Membership>(toUpdate)); _membershipRepository.Save(); } }
public void Create(TaskModel task) { using (_repository = _getRepository()) { _repository.Insert(task); _repository.Save(); } }
public void AddUser(Models.UserProfile toAdd) { using (_userProfileRepository = _userProfileRepositoryInitializer()) { _userProfileRepository.Insert(Mapper.Map<Models.UserProfile, UserProfile>(toAdd)); _userProfileRepository.Save(); } }
public void Remove(int id) { using (_repository = _getRepository()) { _repository.Remove(id); _repository.Save(); } }
public AppLinksService(IPlatformProxy platformProxy, IApplicationSettings applicationSettings, IHashService hashService, IEntitiesRepository entitiesRepository, ILog log) { _platformProxy = platformProxy; _applicationSettings = applicationSettings; _hashService = hashService; _entitiesRepository = entitiesRepository; _log = log; _servicePath = _applicationSettings.AppLinkPath; }
public CreateEntityValidator(IEntitiesRepository <ObjectIdentifier> entitiesRepository) { this.RuleFor(e => e.Name) .NotEmpty() .Must(name => entitiesRepository.Find(new FindEntityByName(name)) == null) .WithMessage("Entity with this name already exists"); this.RuleFor(e => e.Description).NotEmpty(); }
public AppendStepLogCommandHandler(IEntitiesRepository entitiesRepository, ILogger <AppendStepLogCommandHandler> logger, IClusterRequestHandler node ) { _entitiesRepository = entitiesRepository; Logger = logger; _node = node; }
public CreateStepCommandHandler( IEntitiesRepository entitiesRepository, IClusterStateService service, IClusterRequestHandler node) { _entitiesRepository = entitiesRepository; _clusterStateService = service; _node = node; }
public EntitiesDBContext( string connectionString, IEntitiesRepository entitiesRepository, ILogger logger = null) { this.connectionString = connectionString; Logger = logger; this.entitiesRepository = entitiesRepository; }
public void Update(ProjectModel project) { using (_repository = _getRepository()) { ProjectModel toUpdate = _repository.Get(item => item.Id == project.Id).First(); toUpdate.Name = project.Name; _repository.Update(toUpdate); _repository.Save(); } }
public UpdateExecutionScheduleCommandHandler(IEntitiesRepository entitiesRepository, IClusterStateService service, IClusterRequestHandler node, IMediator mediator) { _entitiesRepository = entitiesRepository; _clusterStateService = service; _node = node; _mediator = mediator; }
public void SetSalt(int userId, string salt) { using (_repository = _getRepository()) { MembershipModel membership = _repository.Get(userId); membership.PasswordSalt = salt; _repository.Update(membership); _repository.Save(); } }
public CreateUserCommandHandler( IEntitiesRepository entitiesRepository, ILogger <CreateUserCommandHandler> logger, IServiceProvider prov, IDataRouter router, IClusterRequestHandler node ) { _entitiesRepository = entitiesRepository; _node = (IClusterRequestHandler)prov.GetService(typeof(IClusterRequestHandler)); }
public CreateWorkflowCommandHandler( IEntitiesRepository entitiesRepository, IMediator mediator, IClusterRequestHandler node, ILogger <CreateWorkflowCommandHandler> logger) { _entitiesRepository = entitiesRepository; _mediator = mediator; _node = node; _logger = logger; }
public EntitiesService( IEntitiesRepository <ObjectIdentifier> entitiesRepository, ICommandValidator <CreateEntityCommand, Entity> createCommandValidator, ICommandValidator <UpdateEntityCommand, Entity> updateCommandValidator, IMapper mapper) { _entitiesRepository = entitiesRepository ?? throw new ArgumentNullException(nameof(entitiesRepository)); _createCommandValidator = createCommandValidator ?? throw new ArgumentNullException(nameof(createCommandValidator)); _updateCommandValidator = updateCommandValidator ?? throw new ArgumentNullException(nameof(updateCommandValidator)); _mapper = mapper ?? throw new ArgumentNullException(nameof(mapper)); }
public DocumentService( IFrissFileSystemContext frissFileSystemContext, IFrissDbContext frissDbContext, IFileRepository fileRepository, IEntitiesRepository <Document> documentRepository) { _frissFileSystemContext = frissFileSystemContext; _frissDbContext = frissDbContext; _fileRepository = fileRepository; _documentRepository = documentRepository; }
public EntitiesController( IEntitiesRepository entitiesRepository, EntitiesDBContext dbContext, IQueryableRepository <Entities.FileInfo> filesRepository, IBlobRepository blobRepository) { this.entitiesRepository = entitiesRepository; this.dbContext = dbContext; this.filesRepository = filesRepository; this.blobRepository = blobRepository; }
public InitializeClusterCommandHandler( ILogger <InitializeClusterCommandHandler> logger, IEntitiesRepository entitiesRepository, IMediator mediator, IClusterStateService clusterState ) { _mediator = mediator; _entitiesRepository = entitiesRepository; _logger = logger; _clusterState = clusterState; }
public MetricManagementService( ILogger <MetricManagementService> logger, IClusterRequestHandler node, NodeStateService nodeStateService, IEntitiesRepository entitiesRepository, IConfiguration configuration ) { _logger = logger; _logger.LogInformation("Populating Metrics..."); _metricLibrary = new MetricLibrary(); _node = node; _nodeStateService = nodeStateService; _entitiesRepository = entitiesRepository; _configuration = configuration; EnableMetrics = _configuration.GetValue <bool>("EnableMonitoring"); if (EnableMetrics) { writeThread = new Task(async() => { MetricTick tick; while (true) { // Console.WriteLine("Number of tasks " + _ticks.Count()); if (_nodeStateService.InCluster) { if (_ticks.TryDequeue(out tick)) { tick.Date = tick.Date.ToUniversalTime(); tick.Id = Guid.NewGuid(); var startTime = DateTime.Now; await _node.Handle(new AddShardWriteOperation() { WaitForSafeWrite = true, Operation = ConsensusCore.Domain.Enums.ShardOperationOptions.Create, Data = tick, Metric = false // Do not metric the metric write operations }); _logger.LogDebug("Total write time took " + (DateTime.Now - startTime).TotalMilliseconds + " total ticks left in queue " + _ticks.Count()); if (_ticks.Count > 100) { _logger.LogWarning("Tick count is greater then 100..."); } } } await Task.Delay(10); } }); writeThread.Start(); } }
public string GetPasswordSaltByUserName(string userName) { using (_userProfileRepository = _userProfileRepositoryInitializer()) { IQueryable<UserProfile> foundUserProfilesByName = _userProfileRepository.Get(u => u.UserName.Equals(userName)); int userId = foundUserProfilesByName.Any() ? foundUserProfilesByName.Single().UserId : 0; using (_membershipRepository = _membershipRepositoryInitializer()) { return _membershipRepository.Get(userId).PasswordSalt; } } }
public Models.webpages_Membership GetMembershipByUserName(string userName) { using (_userProfileRepository = _userProfileRepositoryInitializer()) { IQueryable<UserProfile> foundUserProfilesByName = _userProfileRepository.Get(u => u.UserName.Equals(userName)); int userId = foundUserProfilesByName.Any() ? foundUserProfilesByName.Single().UserId : 0; using (_membershipRepository = _membershipRepositoryInitializer()) { return Mapper.Map<webpages_Membership, Models.webpages_Membership>(_membershipRepository.Get(userId)); } } }
public void InitializeCategories() { using (_repository = _getRepository()) { if (!_repository.Get().Any()) { _repository.Insert(new CategoryModel { Name = "Easy" }); _repository.Insert(new CategoryModel { Name = "Difficult" }); _repository.Save(); } } }
public void InitializeRoles() { using (_repository = _getRepository()) { if (!_repository.Get().Any()) { _repository.Insert(new RoleModel { RoleName = "admin" }); _repository.Insert(new RoleModel { RoleName = "user" }); _repository.Save(); } } }
public void Update(SlotModel slot) { using (_repository = _getRepository()) { SlotModel toUpdate = _repository.Get(item => item.Id == slot.Id).First(); toUpdate.Name = slot.Name; toUpdate.StartDate = slot.StartDate; toUpdate.FinishDate = slot.FinishDate; toUpdate.TaskId = slot.TaskId; _repository.Update(toUpdate); _repository.Save(); } }
public UnassignStepCommandHandler(IEntitiesRepository entitiesRepository, ILogger <UnassignStepCommandHandler> logger, IOptionsMonitor <CindiClusterOptions> options, IClusterRequestHandler node) { _entitiesRepository = entitiesRepository; _node = node; Logger = logger; options.OnChange((change) => { _option = change; }); }
public void InitializePriorities() { using (_repository = _getRepository()) { if (!_repository.Get().Any()) { _repository.Insert(new PriorityModel { Name = "Low" }); _repository.Insert(new PriorityModel { Name = "Medium" }); _repository.Insert(new PriorityModel { Name = "High" }); _repository.Insert(new PriorityModel { Name = "Very high" }); _repository.Save(); } } }
public void UpdateCreated(UserModel user) { using (_repository = _getRepository()) { UserModel toUpdate = _repository.Get(item => item.UserName.Equals(user.UserName)).First(); int roleId = user.webpages_Roles.First().RoleId; toUpdate.webpages_Roles = new [] { _repository.GetAnother<Model.RoleModel>(item => item.RoleId == roleId).First() }; _repository.Update(toUpdate); _repository.Save(); } }
public AssignStepCommandHandler( IEntitiesRepository entitiesRepository, IClusterStateService stateService, ILogger <AssignStepCommandHandler> logger, IClusterRequestHandler node, IMemoryCache cache ) { _entitiesRepository = entitiesRepository; _clusterStateService = stateService; Logger = logger; _node = node; _cache = cache; }
public void InitializeTypes() { using (_repository = _getRepository()) { if (!_repository.Get().Any()) { _repository.Insert(new TypeModel { Name = "Epic" }); _repository.Insert(new TypeModel { Name = "Task" }); _repository.Insert(new TypeModel { Name = "Bug" }); _repository.Insert(new TypeModel { Name = "Exception" }); _repository.Save(); } } }
public void Update(UserModel user) { using (_repository = _getRepository()) { UserModel toUpdate = _repository.Get(item => item.UserId == user.UserId, item => item.webpages_Roles).First(); toUpdate.UserName = user.UserName; int roleId = user.webpages_Roles.First().RoleId; toUpdate.webpages_Roles.Clear(); toUpdate.webpages_Roles.Add( _repository.GetAnother<Model.RoleModel>(item => item.RoleId == roleId).First() ); _repository.Update(toUpdate); _repository.Save(); } }
public void InitializeStatuses() { using (_repository = _getRepository()) { if (!_repository.Get().Any()) { _repository.Insert(new StatusModel { Name = "Active" }); _repository.Insert(new StatusModel { Name = "Completed" }); _repository.Insert(new StatusModel { Name = "Suspended" }); _repository.Insert(new StatusModel { Name = "New" }); _repository.Insert(new StatusModel { Name = "Reactivated" }); _repository.Save(); } } }
public CompleteStepCommandHandler(IEntitiesRepository entitiesRepository, IClusterStateService clusterStateService, ILogger <CompleteStepCommandHandler> logger, CindiClusterOptions options, IMediator mediator, IClusterRequestHandler node, NodeStateService nodeStateService ) { _entitiesRepository = entitiesRepository; _clusterStateService = clusterStateService; Logger = logger; _option = options; _node = node; _mediator = mediator; }
public DownaloadController(IFileGenerationsRepository repo, IEntitiesRepository entities, IFileGenerationsRepository fileG, IInventoryItemsRepository iventoryItems, IInventoryTransactionDocumentsRepository iventoryTransactionDocuments, IMenuItemPortionsRepository menuItemPortions, IMenuItemPricesRepository menuItemPrices, IMenuItemsRepository menuItems ) { _repo = repo; _entities = entities; _file = fileG; _iventoryItems = iventoryItems; _iventoryTransactionDocuments = iventoryTransactionDocuments; _menuItemPortions = menuItemPortions; _menuItemPrices = menuItemPrices; _menuItems = menuItems; }
public ScanWorkflowCommandHandler(IEntitiesRepository entitiesRepository, IClusterStateService clusterStateService, ILogger <ScanWorkflowCommandHandler> logger, IOptionsMonitor <CindiClusterOptions> options, IMediator mediator, IClusterRequestHandler node ) { _entitiesRepository = entitiesRepository; _clusterStateService = clusterStateService; Logger = logger; _option = options.CurrentValue; options.OnChange((change) => { _option = change; }); _mediator = mediator; _node = node; }
public UpdateEntityValidator(IEntitiesRepository <ObjectIdentifier> entitiesRepository) { this.RuleFor(e => e.Id) .NotEmpty() .Must((command, id) => { if (!ObjectIdentifier.TryParse(id, out ObjectIdentifier entityId)) { return(false); } var entity = entitiesRepository.Get(entityId); return(entity != null); }) .WithMessage("Entity with such id doesn't exist"); this.RuleFor(e => e.Name) .NotEmpty() .Must(name => entitiesRepository.Find(new FindEntityByName(name)) == null) .WithMessage("Entity with such name already exists"); this.RuleFor(e => e.Description).NotEmpty(); }
public void ListPresentsCorrectPageOfEntities() { IEntitiesRepository repository = MockEntitiesRepository( new Entity { Name = "P1" }, new Entity { Name = "P2" }, new Entity { Name = "P3" }, new Entity { Name = "P4" }, new Entity { Name = "P5" } ); EntitiesController controller = new EntitiesController(repository); controller.PageSize = 3; var result = controller.List(2); Assert.IsNotNull(result, "Didn't render view"); var entities = result.Entities as IList <Entity>; Assert.AreEqual(2, entities.Count, "Got wrong number of products"); Assert.AreEqual(2, result.CurrentPage, "Wrong page number"); Assert.AreEqual(2, result.TotalPages, "Wrong page count"); Assert.AreEqual("P4", entities[0].Name); Assert.AreEqual("P5", entities[1].Name); }
public GetEntitiesQueryHandler(IEntitiesRepository entitiesRepository) { _entitiesRepository = entitiesRepository; }
public EntityMashService(IEntitiesRepository entitiesRepository) { entitiesRepository_ = entitiesRepository; }
public EntitiesController(IEntitiesRepository repository, IConfiguration configuration) { _repository = repository; _configuration = configuration; }
public EntitiesInitializer(IUserService userService, IEntitiesRepository entitiesRepository) { _userService = userService; _entitiesRepository = entitiesRepository; }
public CreateStepTemplateCommandHandler(IEntitiesRepository entitiesRepository, IClusterRequestHandler node, ILogger <CreateStepTemplateCommandHandler> logger) { _entitiesRepository = entitiesRepository; _node = node; Logger = logger; }
public DeleteEntityCommandHandler(IClusterRequestHandler node, IEntitiesRepository entitiesRepository) { _node = node; _entitiesRepository = entitiesRepository; }