public ReportManager(IMemoryRepository <Employee> employees, IEmployeeReport report, IMailGatewayBuilder mailGatewayBuilder, ILogger <IReportManager> logger) { _employees = employees; _report = report; _mailGatewayBuilder = mailGatewayBuilder; _logger = logger; }
public CacheRepository(TimeSpan expireTime, bool defaultIsTouched) : base() { _expireTime = expireTime; _repository = new MemoryRepository <TKey, CacheValue <TValue> >(); _timer = new Timer(Clear, null, new TimeSpan(0, 0, 0), new TimeSpan(0, 2, 0)); _defaultIsTouched = defaultIsTouched; }
public UsersController(IUserRepository context, IMemoryRepository memoRepo, UserManager <IdentityUser> userManager, IHttpContextAccessor httpContextAccessor) { _userRepository = context; _userManager = userManager; _httpContextAccessor = httpContextAccessor; var id = _userManager.GetUserId(_httpContextAccessor.HttpContext.User); User user = _userRepository.GetByEmail(id); _loggedInUser = user; }
private void Synchronize(IMemoryRepository memoryInstance, Type memoryType, Type storageType) { try { Type[] typeArgs = { memoryType }; Type constructed = storageType.MakeGenericType(typeArgs); string dbPath = Path.Combine(Windows.Storage.ApplicationData.Current.LocalFolder.Path, "data"); var storageInstance = (IStorageRepository)Activator.CreateInstance(constructed, new SQLitePlatformWinRT(), new LocalStorage(), DbPath.Create(dbPath), "data.db"); StorageSynchronize(memoryInstance, memoryType, storageInstance); storageContext.Add(storageInstance); } catch { throw new Exception("Repository Manager :: cannot synchronize service"); } }
private void StorageSynchronize(IMemoryRepository memoryInstance, Type memoryType, IStorageRepository storageInstance) { _accessSemaphore.Wait(); try { var entities = typeof(IStorageRepository) .GetMethod("GetAll") .MakeGenericMethod(memoryType) .Invoke(storageInstance, null); memoryInstance.Populate(entities); } catch { throw; } finally { _accessSemaphore.Release(); } }
public UserController(IMemoryRepository memoryRepository, IMapper mapper) { _memoryRepository = memoryRepository; _mapper = mapper; }
public MemoryController(IMemoryRepository repo) { _bll = new MemoryBLL(repo); }
public AuthController(IMemoryRepository memoryRepository) { _memoryRepository = memoryRepository; }
public MemoryBLL(IMemoryRepository repo) { _repo = repo; }
public MemberAuthorizeImpl(IMemoryRepository memoryRepository) { _memoryRepository = memoryRepository; }
//CTOR public MemoryController() { rep = new MemoryRepository(new TransienceDbContext()); }
public MemoryController(IMemoryRepository rep) { this.rep = rep; }
public KidsController(IKidRepository repo, IMemoryRepository memoryRepo, IMapper mapper) { _repo = repo; _memoryRepo = memoryRepo; _mapper = mapper; }
public UserSecretKeyService(IMemoryRepository <UserSecretKey> userSecretKeyRepository) { _userSecretKeyRepository = userSecretKeyRepository; }
private void Subscribe(IMemoryRepository memoryInstance) { memoryInstance.EntitiesChanges.Subscribe(args => { var changeObj = new Tuple <object, NotifyCollectionChangedEventArgs>(args.Sender, args.EventArgs); changedEntities.Enqueue(changeObj); if (synchronizationManager != null) { synchronizationManager.NotifyChange(changeObj); } }); memoryInstance.EntitiesChanges.Throttle(TimeSpan.FromMilliseconds(1000)).Subscribe((args) => { while (changedEntities.Count > 0) { var entityEventArgs = changedEntities.Dequeue(); string actionName = null; IList param = null; Type entityType = null; switch (entityEventArgs.Item2.Action) { case NotifyCollectionChangedAction.Add: actionName = "Add"; param = new List <object>(); for (int i = 0; i < entityEventArgs.Item2.NewItems.Count; i++) { param.Add(entityEventArgs.Item2.NewItems[i]); } entityType = param[0].GetType(); break; case NotifyCollectionChangedAction.Move: throw new NotImplementedException(); break; case NotifyCollectionChangedAction.Remove: actionName = "Delete"; param = new List <object>(); for (int i = 0; i < entityEventArgs.Item2.OldItems.Count; i++) { param.Add(entityEventArgs.Item2.OldItems[i]); } entityType = param[0].GetType(); break; case NotifyCollectionChangedAction.Replace: actionName = "Update"; param = new List <object>(); for (int i = 0; i < entityEventArgs.Item2.NewItems.Count; i++) { param.Add(entityEventArgs.Item2.NewItems[i]); } entityType = param[0].GetType(); break; case NotifyCollectionChangedAction.Reset: actionName = "DeleteAll"; if (entityEventArgs.Item1.GetType().GetGenericArguments()[0] != null) { entityType = entityEventArgs.Item1.GetType().GetGenericArguments()[0]; } else { return; } break; default: break; } if (!String.IsNullOrEmpty(actionName)) { var storageInstance = storageContext.Where((i) => i.GetType().GetGenericArguments()[0] == entityType).FirstOrDefault(); if (param != null) { foreach (var paramItem in param) { storageInstance.GetType().GetMethod(actionName, new Type[] { entityType }).Invoke(storageInstance, new object[] { paramItem }); } } else { storageInstance.GetType().GetMethod(actionName).Invoke(storageInstance, null); } } } }); }
public UserService(IMemoryRepository <User> userRepository) { _userRepository = userRepository; }
/// <summary> /// Initializes a new instance of the <see cref="InMemoryRepositoryAdapter{T}"/> class. /// </summary> /// <param name="repository">The repository.</param> public InMemoryRepositoryAdapter(IMemoryRepository repository) : base(repository) { this._repository = repository; }
public MotherBoardController(IMemoryRepository repo) { _bll = new MemoryBLL(repo); }
public MemoryService(IMemoryRepository memoryRepository) : base(memoryRepository) { this.memoryRepository = memoryRepository; }
public GeneratedOTPService(IMemoryRepository <GeneratedOTP> generatedOTPRepository, IOptions <OTPGeneratorConfiguration> options) { _generatedOTPRepository = generatedOTPRepository; _config = options.Value; }
public MemoriesController(IMemoryRepository repo, IMapper mapper) { _repo = repo; _mapper = mapper; }