static async Task Main(string[] args) { var serviceProvider = new ServiceCollection() .AddDbContext <MGContext>(c => c.UseInMemoryDatabase("Test")) .AddScoped(typeof(IRepository <>), typeof(MGRepository <>)) .AddScoped <ITestTableRepository, TestTableRepository>() .BuildServiceProvider(); TestTableRepository = serviceProvider.GetService <ITestTableRepository>(); TestTable testTable = new TestTable() { CreateDate = DateTime.Now, Deleted = false, Id = 1, TestData = "Test1" }; var entity = await AddTestTableEntity(testTable); var getEntity = await GetTestTableEntityById(testTable.Id); getEntity.TestData = "Updated"; var updatedEntity = await UpdateTestTableEntity(getEntity); getEntity = await GetTestTableEntityById(testTable.Id); testTable.Id = 2; entity = await AddTestTableEntity(testTable); var getEntityList = await GetTestTableEntityList(); var deletedEntity = await DeleteTestTableEntity(testTable); getEntityList = await GetTestTableEntityList(); }
public BackgroundJobService(IUnitOfWork unitOfWork , ITestTableRepository TestTableRepository, IRequestInfo <TemplateContext> requestInfo, IMapper mapper) { _requestInfo = requestInfo; _mapper = mapper; _unitOfWork = unitOfWork; _TestTableRepository = TestTableRepository; }
public TestTableService( IMapper mapper, ITestTableRepository testTableRepository ) { _mapper = mapper; _testTableRepository = testTableRepository; }
public UnitOfWork(ITestTableRepository testTableRepository) { Tests = testTableRepository; }