/// <summary> /// Updates the without email and password. /// </summary> /// <param name="customer">The customer.</param> /// <exception cref="NotImplementedException"></exception> public void UpdateWithoutEmailAndPassword(Customer customer) { var customerEntry = FrederickContext.Entry(customer); customerEntry.Property("FirstName").IsModified = true; customerEntry.Property("LastName").IsModified = true; customerEntry.Property("CountryId").IsModified = true; }
/// <summary> /// dispatch domain events as an asynchronous operation. /// </summary> /// <param name="mediator">The mediator.</param> /// <param name="ctx">The CTX.</param> /// <returns>Task.</returns> public static async Task DispatchDomainEventsAsync(this IMediator mediator, FrederickContext ctx) { var domainEntities = ctx.ChangeTracker .Entries <Entity>() .Where(x => x.Entity.DomainEvents != null && x.Entity.DomainEvents.Any()); var domainEvents = domainEntities.SelectMany(x => x.Entity.DomainEvents).ToList(); domainEntities.ToList().ForEach(entity => entity.Entity.DomainEvents.Clear()); var tasks = domainEvents.Select(async(domainEvent) => { await mediator.Publish(domainEvent); }); await Task.WhenAll(tasks); }
/// <summary> /// Initializes a new instance of the <see cref="ProductRepository"/> class. /// </summary> /// <param name="dbContext">The database context.</param> public ProductRepository(FrederickContext dbContext) : base(dbContext) { }
/// <summary> /// Initializes a new instance of the <see cref="EfRepository{T}"/> class. /// </summary> /// <param name="dbContext">The database context.</param> public EfRepository(FrederickContext dbContext) { FrederickContext = dbContext; }
/// <summary> /// Initializes a new instance of the <see cref="UnitOfWork"/> class. /// </summary> /// <param name="context">The context.</param> public UnitOfWork(FrederickContext context) { _frederickContext = context; }
/// <summary> /// Initializes a new instance of the <see cref="CustomerRepository"/> class. /// </summary> /// <param name="dbContext">The database context.</param> public CustomerRepository(FrederickContext dbContext) : base(dbContext) { }
/// <summary> /// Initializes a new instance of the <see cref="UnitOfWork" /> class. /// </summary> /// <param name="context">The context.</param> /// <param name="mediator">The mediator.</param> public UnitOfWork(FrederickContext context, IMediator mediator) { _frederickContext = context; _mediator = mediator; }