public void Init() { // Create the container builder. var servicesColletcion = new ServiceCollection(); servicesColletcion.AddTransient <IUnitOfWork, UnitOfWork>(); servicesColletcion.AddDbContext <SisLogFreteContext>( options => options.UseSqlServer(@"Server=")); servicesColletcion.AddTransient <ICotarFreteService, CotarFreteService>(); _provider = servicesColletcion.BuildServiceProvider(); _unitOfWork = _provider.GetService <IUnitOfWork>(); _cotarFreteService = _provider.GetService <ICotarFreteService>(); _unitOfWork.BaseFretes.RemoveRange(_unitOfWork.BaseFretes.GetAll()); _unitOfWork.OrigemDestinos.RemoveRange(_unitOfWork.OrigemDestinos.GetAll()); _unitOfWork.Cidades.RemoveRange(_unitOfWork.Cidades.GetAll()); _unitOfWork.Commit(); }
public CotarFreteController(ICotarFreteService cotarFreteService) { _cotarFreteService = cotarFreteService; }