예제 #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>();
        }
예제 #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));
 }
예제 #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);
        }
예제 #4
0
 public BrandService(ICatalogDbContext catalogDbContext, IModelValidator <Brand> validator)
 {
     _catalogDbContext = catalogDbContext;
     _validator        = validator;
 }
예제 #5
0
 public CatalogSeed(ICatalogDbContext context)
 {
     _context = context;
 }
예제 #6
0
 public ProductService(ICatalogDbContext catalogDbContext, IProductValidator productValidator)
 {
     _catalogDbContext = catalogDbContext;
     _productValidator = productValidator;
 }
 public ProductDeleteCommandHandler(ICatalogDbContext context)
 {
     _context = context;
 }
예제 #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"));
 }
예제 #10
0
 public UpsertProductCommandHandler(ICatalogDbContext context, IMediator mediator)
 {
     _context  = context;
     _mediator = mediator;
 }
예제 #11
0
 public BrandCommandHandler(ICatalogDbContext context)
 {
     _context = context;
 }
 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);
 }
예제 #14
0
 public GetTrackQueryHandler(ICatalogDbContext context, IMapper mapper)
 {
     _context = context ?? throw new ArgumentNullException(nameof(context));
     _mapper  = mapper ?? throw new ArgumentNullException(nameof(mapper));
 }
 public CatalogService(ICatalogDbContext context)
 {
     this.context = context;
 }
예제 #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);
 }
예제 #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);
 }
예제 #19
0
 public SupplierService(ICatalogDbContext catalogDbContext, IModelValidator <Supplier> validator)
 {
     _catalogDbContext = catalogDbContext;
     _validator        = validator;
 }
예제 #20
0
 public BrandQueryHandler(ICatalogDbContext context)
 {
     _context = context;
 }
 public CatalogService(ICatalogDbContext context)
 {
     this.context = context;
 }
 public DeletePlaylistCommandHandler(ICatalogDbContext context)
 {
     _context = context ?? throw new ArgumentNullException(nameof(context));
 }
예제 #23
0
 public GetProductsListQueryHandler(ICatalogDbContext context, IMapper mapper)
 {
     _context = context;
     _mapper  = mapper;
 }
예제 #24
0
 public DeletableEntityRepository(ICatalogDbContext context)
     : base(context)
 {
 }
예제 #25
0
 public ProductValidator(ICatalogDbContext catalogDbContext)
 {
     _catalogDbContext = catalogDbContext;
 }
예제 #26
0
 public CategoryRepository(ICatalogDbContext catalogContext)
 {
     _context = catalogContext ?? throw new ArgumentNullException(nameof(catalogContext));
 }
예제 #27
0
 public ProductRepository(ICatalogDbContext context)
 {
     _context = context;
 }
예제 #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;
 }