public void Setup() { mapper = new MapperConfiguration(mc => { mc.AddProfile(new MappingProfile()); }).CreateMapper(); factory = new UnitOfWorkFactory(); repoLifeEvent = factory.CreateUnitOfWork().LifeEvents; modelLifeEvent = new LifeEventModel(factory, mapper); }
public void Setup() { serviceProvider = new ServiceCollection() .AddTransient <ILifeEventRepository, LifeEventRepository>() .AddTransient <IUnitOfWork, UnitOfWork>() .AddSingleton <ILifeEventDao, LifeEventDao>() //.AddSingleton<Mapper>() //.AddSingleton<ILifeEventService, LifeEventService>() .BuildServiceProvider(); mapper = new MapperConfiguration(mc => { mc.AddProfile(new MappingProfile()); }).CreateMapper(); var unit = serviceProvider.GetService <IUnitOfWork>(); repoLifeEvent = unit.LifeEvents; lifeEventService = serviceProvider.GetService <ILifeEventService>(); }
public UnitOfWork(ILifeEventRepository lifeEventRepository) { this.LifeEvents = lifeEventRepository; }