Exemplo n.º 1
0
        public EfGenericRepository(ICatalogDbContext context)
        {
            if (context == null)
            {
                throw new ArgumentException("An instance of DbContext is required to use this repository.", "context");
            }

            this.Context = context.DbContext;
            this.DbSet   = this.Context.Set <T>();
        }
Exemplo n.º 2
0
 public GetTrackListQueryHandler(
     ICatalogDbContext context,
     ITrackFilterBuilder filterBuilder,
     IEntityOrderBuilder <Track> orderBuilder,
     IMapper mapper)
 {
     _context       = context ?? throw new ArgumentNullException(nameof(context));
     _filterBuilder = filterBuilder ?? throw new ArgumentNullException(nameof(filterBuilder));
     _orderBuilder  = orderBuilder ?? throw new ArgumentNullException(nameof(orderBuilder));
     _mapper        = mapper ?? throw new ArgumentNullException(nameof(mapper));
 }
Exemplo n.º 3
0
        public static Task Send(string accion, string message, ICatalogDbContext _context, CancellationToken cancellationToken)
        {
            _context.Audits.Add(new Audit {
                Date    = DateTime.Now,
                Action  = accion,
                IsError = true,
                Message = message
            });

            _context.SaveChangesAsync(cancellationToken);

            return(Task.CompletedTask);
        }
Exemplo n.º 4
0
 public BrandService(ICatalogDbContext catalogDbContext, IModelValidator <Brand> validator)
 {
     _catalogDbContext = catalogDbContext;
     _validator        = validator;
 }
Exemplo n.º 5
0
 public CatalogSeed(ICatalogDbContext context)
 {
     _context = context;
 }
Exemplo n.º 6
0
 public ProductService(ICatalogDbContext catalogDbContext, IProductValidator productValidator)
 {
     _catalogDbContext = catalogDbContext;
     _productValidator = productValidator;
 }
 public ProductDeleteCommandHandler(ICatalogDbContext context)
 {
     _context = context;
 }
Exemplo n.º 8
0
 public RepositoryBase(ICatalogDbContext catalogContext)
 {
     _context      = catalogContext ?? throw new ArgumentNullException(nameof(catalogContext));
     _dbCollection = _context.GetCollection <T>(typeof(T).Name);
 }
 public static IRuleBuilderOptions <T, Guid> ProductExists <T>(this IRuleBuilderInitial <T, Guid> builder, ICatalogDbContext context)
 {
     return(builder.MustAsync(async(Guid productId, CancellationToken cancellationToken) =>
     {
         var product = await context.Products.FindAsync(new object[] { productId }, cancellationToken);
         return product != null;
     }).WithErrorCode("ProductNotExists"));
 }
Exemplo n.º 10
0
 public UpsertProductCommandHandler(ICatalogDbContext context, IMediator mediator)
 {
     _context  = context;
     _mediator = mediator;
 }
Exemplo n.º 11
0
 public BrandCommandHandler(ICatalogDbContext context)
 {
     _context = context;
 }
Exemplo n.º 12
0
 public CreatePlaylistCommandHandler(ICatalogDbContext context, IMapper mapper)
 {
     _context = context ?? throw new ArgumentNullException(nameof(context));
     _mapper  = mapper ?? throw new ArgumentNullException(nameof(mapper));
 }
 public ProductDeleteCommandValidation(ICatalogDbContext context)
 {
     RuleFor(x => x.ProductId).ProductExists(context);
 }
Exemplo n.º 14
0
 public GetTrackQueryHandler(ICatalogDbContext context, IMapper mapper)
 {
     _context = context ?? throw new ArgumentNullException(nameof(context));
     _mapper  = mapper ?? throw new ArgumentNullException(nameof(mapper));
 }
Exemplo n.º 15
0
 public CatalogService(ICatalogDbContext context)
 {
     this.context = context;
 }
Exemplo n.º 16
0
 public NotFoundException(string name, object key, ICatalogDbContext context, CancellationToken cancellationToken)
     : base($"Entidad '{name}' ({key}) no fue encontrada.")
 {
     ExceptionAudit.Send("", $"Entidad '{name}' ({key}) no fue encontrada.", context, cancellationToken);
 }
Exemplo n.º 17
0
 public UpdateTrackCommandHandler(ICatalogDbContext context)
 {
     _context = context ?? throw new ArgumentNullException(nameof(context));
 }
 public ProductUpdateCommandValidator(ICatalogDbContext context)
 {
     RuleFor(x => x.Name).NotEmpty();
     RuleFor(x => x.Description).NotEmpty();
     RuleFor(x => x.ProductId).ProductExists(context);
 }
Exemplo n.º 19
0
 public SupplierService(ICatalogDbContext catalogDbContext, IModelValidator <Supplier> validator)
 {
     _catalogDbContext = catalogDbContext;
     _validator        = validator;
 }
Exemplo n.º 20
0
 public BrandQueryHandler(ICatalogDbContext context)
 {
     _context = context;
 }
Exemplo n.º 21
0
 public CatalogService(ICatalogDbContext context)
 {
     this.context = context;
 }
Exemplo n.º 22
0
 public DeletePlaylistCommandHandler(ICatalogDbContext context)
 {
     _context = context ?? throw new ArgumentNullException(nameof(context));
 }
Exemplo n.º 23
0
 public GetProductsListQueryHandler(ICatalogDbContext context, IMapper mapper)
 {
     _context = context;
     _mapper  = mapper;
 }
Exemplo n.º 24
0
 public DeletableEntityRepository(ICatalogDbContext context)
     : base(context)
 {
 }
Exemplo n.º 25
0
 public ProductValidator(ICatalogDbContext catalogDbContext)
 {
     _catalogDbContext = catalogDbContext;
 }
Exemplo n.º 26
0
 public CategoryRepository(ICatalogDbContext catalogContext)
 {
     _context = catalogContext ?? throw new ArgumentNullException(nameof(catalogContext));
 }
Exemplo n.º 27
0
 public ProductRepository(ICatalogDbContext context)
 {
     _context = context;
 }
Exemplo n.º 28
0
 public RequestLogger(ILogger <TRequest> logger, ICatalogDbContext context)
 {
     _logger  = logger;
     _context = context;
 }
 public ProductCreateCommandHandler(ICatalogDbContext context, IEventBusManager eventBusManager, IMapper mapper)
 {
     _context         = context;
     _eventBusManager = eventBusManager;
     _mapper          = mapper;
 }