コード例 #1
0
 public ContactManager(ILogger <Contact> logger,
                       ISimpleRepository <Contact> contactEntity,
                       ISimpleRepository <Address> addressEntity) : base(logger)
 {
     _contactEntity = contactEntity;
     _addressEntity = addressEntity;
 }
コード例 #2
0
        public EFormIntegrated() : base()
        {
            var dbSource = DbContextSelector.getInstance().getDbFactory(DbContextSelector.DbName.Workflow);

            requestHeaderRepo  = new RequestHeaderRepository(dbSource);
            formIntegratedRepo = new SimpleRepository <TicketFormIntegrated>(dbSource);
        }
コード例 #3
0
        public ProfileManagerMock()
        {
            var opt = new DbContextOptionsBuilder <AppDbContext>().UseInMemoryDatabase("DDD_Db").Options;

            _context = new AppDbContext(opt);
            _repo    = new SimpleRepository <UserProfile>(_context);
        }
コード例 #4
0
        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);
        }
コード例 #5
0
        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);
        }
コード例 #6
0
        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));
        }
コード例 #7
0
        //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;
        }
コード例 #8
0
        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);
        }
コード例 #9
0
        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);
        }
コード例 #10
0
 public static void Add <T>(this ISimpleRepository simpleRepository, params T[] entities) where T : class
 {
     simpleRepository.Add(entities);
 }
コード例 #11
0
        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);
        }
コード例 #12
0
ファイル: SimpleLogic.cs プロジェクト: ZorinIvanA/MISIS_CI
 public SimpleLogic(ISimpleRepository simpleRepository)
 {
     _simpleRepository = simpleRepository ??
                         throw new ArgumentNullException(nameof(simpleRepository));
 }
コード例 #13
0
 public FooDemoService(ISimpleRepository simpleRepository)
 {
     Repository = simpleRepository;
 }
コード例 #14
0
 public IntegratedActMsgHandler(TicketFormIntegrated fm, ISimpleRepository <TicketFormIntegrated> formIntegratedRepo)
 {
     this.formIntegrated     = fm;
     this.formIntegratedRepo = formIntegratedRepo;
 }
コード例 #15
0
 public BarDemoService(ISimpleRepository simpleRepository, IFooDemoService fooDemoService)
 {
     Repository     = simpleRepository;
     FooDemoService = fooDemoService;
 }
コード例 #16
0
 public static void Delete <T>(this ISimpleRepository simpleRepository, params T[] entities) where T : class
 {
     simpleRepository.Delete(entities);
 }
コード例 #17
0
ファイル: SimpleService.cs プロジェクト: 0215/mhg-BasePackage
 public SimpleService(ISimpleRepository simpleRepository)
 {
     _simpleRepository = simpleRepository;
 }
コード例 #18
0
 public SimpleController(ISimpleRepository SimpleRepository)
 {
     _SimpleRepository = SimpleRepository;
 }