public ContactManager(ILogger <Contact> logger, ISimpleRepository <Contact> contactEntity, ISimpleRepository <Address> addressEntity) : base(logger) { _contactEntity = contactEntity; _addressEntity = addressEntity; }
public EFormIntegrated() : base() { var dbSource = DbContextSelector.getInstance().getDbFactory(DbContextSelector.DbName.Workflow); requestHeaderRepo = new RequestHeaderRepository(dbSource); formIntegratedRepo = new SimpleRepository <TicketFormIntegrated>(dbSource); }
public ProfileManagerMock() { var opt = new DbContextOptionsBuilder <AppDbContext>().UseInMemoryDatabase("DDD_Db").Options; _context = new AppDbContext(opt); _repo = new SimpleRepository <UserProfile>(_context); }
public MailEntegrated() : base() { var dbSource = DbContextSelector.getInstance().getDbFactory(DbContextSelector.DbName.Workflow); emailRepo = new SimpleRepository <EmailItem>(dbSource); deptRepo = new TicketDepartmentRepository(dbSource); fileUploadRepo = new UploadFileRepository(DbContextSelector.getInstance().getDbFactory(DbContextSelector.DbName.WorkflowDoc)); emailAttchedRepo = new SimpleRepository <Domain.Entities.Email.FileAttachement>(dbSource); }
protected override ISimpleRepository ResolveRepository() { if (_simpleRepository == null) { var memeoryRepository = new MemeoryRepository(); memeoryRepository.InitFor(() => { //return new List<Issue>(); var guids = GuidHelper.CreateMockGuidQueue(10); var issueViewModels = new List <Issue>(); for (int i = 1; i <= 10; i++) { issueViewModels.Add(new Issue() { Id = guids.Dequeue(), Subject = i.ToString("0000"), Body = "BODY..." }); } return(issueViewModels); }); memeoryRepository.InitFor(() => { var guids = GuidHelper.CreateMockGuidQueue(3); var issueCategories = new List <IssueCategory>(); for (int i = 1; i <= 3; i++) { issueCategories.Add(new IssueCategory() { Id = guids.Dequeue(), Name = "分类" + i.ToString("0000") }); } return(issueCategories); }); memeoryRepository.InitFor(() => { var guids = GuidHelper.CreateMockGuidQueue(3); var users = new List <IssueUser>(); for (int i = 1; i <= 3; i++) { users.Add(new IssueUser() { Id = guids.Dequeue(), Name = "用户" + i.ToString("0000") }); } return(users); }); _simpleRepository = memeoryRepository; } return(_simpleRepository); }
public async Task CanStoreAndDelete() { RegisterServices(); BuildServiceProvider(); ISimpleRepository <TestEntity> testRepository = TestServiceProvider.GetRequiredService <ISimpleRepository <TestEntity> >(); await testRepository.Insert(TestEntity); await testRepository.Delete(TestEntity.ID); await Assert.ThrowsExceptionAsync <KeyNotFoundException>(() => testRepository.Fetch(TestEntity.ID)); }
//private readonly IMatchRepository repo; public MatchesController( IHubContext <Broadcaster, IBroadcaster> Broadcaster, ISimpleRepository simp, IUnitOfWork uof, IMapper mapper //IMatchRepository repo ) : base(Broadcaster) { this.simp = simp; this.uof = uof; this.mapper = mapper; //this.repo = repo; }
public async Task CanStoreAndRetrieve() { RegisterServices(); BuildServiceProvider(); ISimpleRepository <TestEntity> testRepository = TestServiceProvider.GetRequiredService <ISimpleRepository <TestEntity> >(); await testRepository.Insert(TestEntity); TestEntity fetched = await testRepository.Fetch(TestEntity.ID); Assert.AreNotEqual(0, fetched.ID); Assert.AreEqual(TestEntity.ID, fetched.ID); Assert.AreNotSame(TestEntity, fetched); }
public async Task CanStoreAndUpdate() { RegisterServices(); BuildServiceProvider(); ISimpleRepository <TestEntity> testRepository = TestServiceProvider.GetRequiredService <ISimpleRepository <TestEntity> >(); await testRepository.Insert(TestEntity); await testRepository.Update(TestEntity.ID) .Set(testEntity => testEntity.NullableIntValue, TestEntity.IntValue) .Set(testEntity => testEntity.DateTimeValue, DateTime.MaxValue) .Execute(); TestEntity actual = await testRepository.Fetch(TestEntity.ID); Assert.IsNull(TestEntity.NullableIntValue); Assert.AreEqual(TestEntity.IntValue, actual.NullableIntValue); Assert.AreNotEqual(TestEntity.DateTimeValue, actual.DateTimeValue); Assert.AreEqual(DateTime.MaxValue, actual.DateTimeValue); Assert.AreNotSame(TestEntity, actual); }
public static void Add <T>(this ISimpleRepository simpleRepository, params T[] entities) where T : class { simpleRepository.Add(entities); }
private async void LoadSimpleData(ISimpleRepository repository, string value) { var loader = LoadSimpleDataFactory.CreateFromSomeDataSource(value); var loadResult = await repository.LoadAsync(loader); Assert.IsTrue(loadResult.Success); Assert.IsNull(loadResult.Exception); Assert.IsFalse(repository.IsEmpty); Assert.AreEqual(value, repository.Data.Value); }
public SimpleLogic(ISimpleRepository simpleRepository) { _simpleRepository = simpleRepository ?? throw new ArgumentNullException(nameof(simpleRepository)); }
public FooDemoService(ISimpleRepository simpleRepository) { Repository = simpleRepository; }
public IntegratedActMsgHandler(TicketFormIntegrated fm, ISimpleRepository <TicketFormIntegrated> formIntegratedRepo) { this.formIntegrated = fm; this.formIntegratedRepo = formIntegratedRepo; }
public BarDemoService(ISimpleRepository simpleRepository, IFooDemoService fooDemoService) { Repository = simpleRepository; FooDemoService = fooDemoService; }
public static void Delete <T>(this ISimpleRepository simpleRepository, params T[] entities) where T : class { simpleRepository.Delete(entities); }
public SimpleService(ISimpleRepository simpleRepository) { _simpleRepository = simpleRepository; }
public SimpleController(ISimpleRepository SimpleRepository) { _SimpleRepository = SimpleRepository; }