public void Init() { this.userRepo = new Mock <IEfRepostory <User> >(); this.carAdServicesMocked = new Mock <ICarAdServices>().Object; this.unitOfWorkMocked = new Mock <IEfUnitOfWork>().Object; this.users = new List <User>() { new User { UserName = "******" }, new User { UserName = "******" }, new User { UserName = "******" }, }; this.expectedUser = new User { UserName = "******" }; users.Add(expectedUser); var usersAsQuarable = this.users.AsQueryable(); this.userRepo.Setup(x => x.All).Returns(usersAsQuarable); }
public DynamicSeparateRepository(DbFactory dbFactory, ContextFactory contextFactory) : base(dbFactory) { DbFactory = dbFactory; ContextFactory = contextFactory; EfUnitOfWork = new DynamicUnitOfWork <TEntity>(contextFactory, dbFactory); }
public void Init() { this.carAdsRepoMock = new Mock <IEfRepostory <CarAd> >(); this.carBrandsRepoMock = new Mock <IEfRepostory <CarBrand> >().Object; this.carModelsRepoMock = new Mock <IEfRepostory <CarModel> >().Object; this.carFeatureServicesMock = new Mock <ICarFeatureServices>().Object; this.unitOfWorkMocked = new Mock <IEfUnitOfWork>().Object; this.carAds = new List <CarAd> { new CarAd { Title = "Awesome car!" }, new CarAd { Title = "Wohoo. Can be yours" }, new CarAd { Title = "Be fast!" }, }; this.expectedCarAd = new CarAd { Title = "Wohooo" }; carAds.Add(expectedCarAd); var carAdsQuarable = this.carAds.AsQueryable(); this.carAdsRepoMock.Setup(x => x.All).Returns(carAdsQuarable); }
public override void Dispose() { EfUnitOfWork?.Dispose(); EfUnitOfWork = null; ContextFactory?.Dispose(); ContextFactory = null; }
public InventoryService(IEfUnitOfWork unitOfWork, IMappingProvider mapper, IEfGenericRepository <Inventory> inventories) { Guard.WhenArgument(unitOfWork, "unitOfWork").IsNull().Throw(); Guard.WhenArgument(mapper, "mapper").IsNull().Throw(); Guard.WhenArgument(inventories, "inventories").IsNull().Throw(); this.inventories = inventories; }
public AddsServices(IEfRepository <Add> adds, IEfUnitOfWork context) { Guard.WhenArgument(adds, "adds").IsNull().Throw(); Guard.WhenArgument(context, "context").IsNull().Throw(); this.adds = adds; this.context = context; }
public void Init() { this.carAdsRepoMock = new Mock <IEfRepostory <CarAd> >().Object; this.carBrandsRepoMock = new Mock <IEfRepostory <CarBrand> >().Object; this.carModelsRepoMock = new Mock <IEfRepostory <CarModel> >().Object; this.carFeatureServicesMock = new Mock <ICarFeatureServices>().Object; this.unitOfWorkMocked = new Mock <IEfUnitOfWork>().Object; }
public void Dispose() { EfUnitOfWork?.Dispose(); EfUnitOfWork = null; _entities = null; ContextFactory?.Dispose(); ContextFactory = null; }
public CategoriesServices(IEfRepository <Category> categories, IEfUnitOfWork context) { Guard.WhenArgument(context, "context").IsNull().Throw(); Guard.WhenArgument(categories, "categories").IsNull().Throw(); this.categories = categories; this.context = context; }
public override void Dispose() { base.Dispose(); EfUnitOfWork = null; _entities = null; ContextFactory?.Dispose(); ContextFactory = null; }
public ProvincesServices(IEfRepository <Province> provinces, IEfUnitOfWork context) { Guard.WhenArgument(context, "context").IsNull().Throw(); Guard.WhenArgument(provinces, "provinces").IsNull().Throw(); this.provinces = provinces; this.context = context; }
public ProductService(IEfUnitOfWork unitOfWork, IEfGenericRepository <Product> products, IMappingProvider mapper) { Guard.WhenArgument(unitOfWork, "unitofwork").IsNull().Throw(); Guard.WhenArgument(products, "GenRepo").IsNull().Throw(); Guard.WhenArgument(mapper, "mapper").IsNull().Throw(); this.unitOfWork = unitOfWork; this.products = products; this.mapper = mapper; }
public Handler( ILogger <CreateUserCommand> logger, IEfUnitOfWork <UserDataContext> context, IEventBus eventBus) { _logger = logger; _context = context; _eventBus = eventBus; }
public GenericRepository(IUnitOfWork uoW) { if (uoW == null) { throw new ArgumentNullException("uoW", "GenericRepository: Unit of Work not Provided"); } _unitOfWork = (IEfUnitOfWork <ObjectContext>)uoW; _context = _unitOfWork.GetContext; }
public RegistrationService(IEfRepository <RegularUser> usersRepo, IEfUnitOfWork unitOfWork) { Guard.WhenArgument(usersRepo, "usersRepo").IsNull().Throw(); Guard.WhenArgument(unitOfWork, "unitOfWork").IsNull().Throw(); this.usersRepo = usersRepo; this.unitOfWork = unitOfWork; }
public override void OnActionExecuting(ActionExecutingContext filterContext) { IEfUnitOfWork uow = DependencyResolver.Current.GetService(typeof(IEfUnitOfWork)) as IEfUnitOfWork; Guard.WhenArgument(uow, "unitOfWork").IsNull().Throw(); this.unitOfWork = uow; base.OnActionExecuting(filterContext); }
public UserServices(IEfRepostory <User> usersRepo, ICarAdServices carAdServices, IEfUnitOfWork unitOfWork) { Guard.WhenArgument(usersRepo, "usersRepo").IsNull().Throw(); Guard.WhenArgument(carAdServices, "carAdServices").IsNull().Throw(); Guard.WhenArgument(unitOfWork, "unitOfWork").IsNull().Throw(); this.usersRepo = usersRepo; this.carAdServices = carAdServices; this.unitOfWork = unitOfWork; }
public CarOffersService(IEfRepository <CarOffer> carOffersRepo, IEfUnitOfWork dbContext) { if (carOffersRepo == null || dbContext == null) { throw new ArgumentNullException("CarOffersRepo and dbContext can not be null!"); } this.carOffersRepo = carOffersRepo; this.dbContext = dbContext; }
public OrderService(IEfUnitOfWork unitOfWork, IMappingProvider mapper, IEfGenericRepository <Order> orders) { Guard.WhenArgument(unitOfWork, "unitOfWork").IsNull().Throw(); Guard.WhenArgument(mapper, "mapper").IsNull().Throw(); Guard.WhenArgument(orders, "orders").IsNull().Throw(); this.unitOfWork = unitOfWork; this.mapper = mapper; this.orders = orders; }
public ProductService(IEfQuerable <Product> products, IEfUnitOfWork unitOfWork, IMapperService mapperService) { Guard.WhenArgument(products, nameof(products)).IsNull().Throw(); Guard.WhenArgument(unitOfWork, nameof(unitOfWork)).IsNull().Throw(); Guard.WhenArgument(mapperService, nameof(mapperService)).IsNull().Throw(); this.products = products; this.unitOfWork = unitOfWork; this.mapperService = mapperService; }
public UserService(IEfRepository <RegularUser> regularUsersRepo, IEfRepository <UploadedImage> uploadedImagesRepo, IEfUnitOfWork unitOfWork) { Guard.WhenArgument(regularUsersRepo, "regularUsersRepo").IsNull().Throw(); Guard.WhenArgument(uploadedImagesRepo, "uploadedImagesRepo").IsNull().Throw(); Guard.WhenArgument(unitOfWork, "unitOfWork").IsNull().Throw(); this.regularUsersRepo = regularUsersRepo; this.uploadedImagesRepo = uploadedImagesRepo; this.unitOfWork = unitOfWork; }
public UserService(IMappingProvider mapper, IHashingPassword hashing, IEfUnitOfWork unitOfWork, IEfGenericRepository <User> users) { Guard.WhenArgument(mapper, "mapper").IsNull().Throw(); Guard.WhenArgument(hashing, "hashing").IsNull().Throw(); Guard.WhenArgument(unitOfWork, "unitOfWork").IsNull().Throw(); Guard.WhenArgument(users, "userRepo").IsNull().Throw(); this.hashing = hashing; this.unitOfWork = unitOfWork; this.mapper = mapper; this.users = users; }
//private readonly ContextType _contextType; //protected MarukoBaseRepository(IEfUnitOfWork unitOfWork, ContextType contextType) //{ // if (unitOfWork == null) // throw new ArgumentNullException("unitOfWork is null"); // UnitOfWork = unitOfWork; // _unitOfWork = unitOfWork; // _contextType = contextType; //} protected MarukoBaseRepository(IEfUnitOfWork unitOfWork) { if (unitOfWork == null) { throw new ArgumentNullException("unitOfWork is null"); } UnitOfWork = unitOfWork; _unitOfWork = unitOfWork; //_contextType = AttributeExtension.GetContextAttributeValue<TEntity>(); }
public UploadedImageService(IEfRepository <UploadedImage> imagesRepo, IEfRepository <RegularUser> usersRepo, IEfUnitOfWork uow) { Guard.WhenArgument(imagesRepo, "imagesRepo").IsNull().Throw(); Guard.WhenArgument(usersRepo, "usersRepo").IsNull().Throw(); Guard.WhenArgument(uow, "uow").IsNull().Throw(); this.imagesRepo = imagesRepo; this.usersRepo = usersRepo; this.uow = uow; }
public AddressService(IEfUnitOfWork unitOfWork, IMappingProvider mapper, IUserService userService, IEfGenericRepository <Address> addresses) { Guard.WhenArgument(unitOfWork, "unitOfWork").IsNull().Throw(); Guard.WhenArgument(mapper, "mapper").IsNull().Throw(); Guard.WhenArgument(userService, "userService").IsNull().Throw(); Guard.WhenArgument(addresses, "addresses").IsNull().Throw(); this.unitOfWork = unitOfWork; this.mapper = mapper; this.userService = userService; this.addresses = addresses; }
public BankCardService(IEfUnitOfWork unitOfWork, IMappingProvider mapper, IUserService userService, IEfGenericRepository <BankCard> bankCards) { Guard.WhenArgument(unitOfWork, "unitOfWork").IsNull().Throw(); Guard.WhenArgument(mapper, "mapper").IsNull().Throw(); Guard.WhenArgument(userService, "userService").IsNull().Throw(); Guard.WhenArgument(bankCards, "bankCards").IsNull().Throw(); this.unitOfWork = unitOfWork; this.mapper = mapper; this.userService = userService; this.bankCards = bankCards; }
public void Init() { this.repoMocked = new Mock <IEfRepository <Add> >(); this.unitOfWork = new Mock <IEfUnitOfWork>().Object; this.adds = new List <Add> { new Add { Description = "car", IsDeleted = false, Id = Guid.NewGuid() } }.AsQueryable(); repoMocked.Setup(x => x.All).Returns(adds); }
public void Init() { this.repoMocked = new Mock <IEfRepository <City> >(); this.unitOfWork = new Mock <IEfUnitOfWork>().Object; this.cities = new List <City> { new City { Name = "Sofia", Id = 1, ProvinceId = 1 } }.AsQueryable(); repoMocked.Setup(x => x.All).Returns(cities); }
public void Init() { this.provinceRepoMocked = new Mock <IEfRepository <Province> >(); this.unitOfWork = new Mock <IEfUnitOfWork>().Object; this.provinces = new List <Province> { new Province { ProvinceName = "Sofia", Id = 1 } }.AsQueryable(); provinceRepoMocked.Setup(x => x.All).Returns(provinces); }
public void Init() { this.repoMocked = new Mock <IEfRepository <Category> >(); this.unitOfWork = new Mock <IEfUnitOfWork>().Object; this.cat = new List <Category> { new Category { CategorieName = "one", Id = 1 } }.AsQueryable(); repoMocked.Setup(x => x.All).Returns(cat); }