public static IDependencyInjectionFlowBuilderContext <EntityValidationResult <TEntity> > Unique <TEntity, TDbContext>(this IDependencyInjectionFlowBuilderContext <EntityValidationResult <TEntity> > builder, Action <UniqueValidateConfigurator <TEntity, TDbContext> > options) where TEntity : class where TDbContext : DbContext { return(builder.Then((IServiceProvider sp) => { var validator = new UniqueValidate <TEntity, TDbContext>(sp.GetRequiredService <IScopedDbContext <TDbContext> >()); var optionContext = new UniqueValidateConfigurator <TEntity, TDbContext>(validator); options(optionContext); return validator; })); }
internal UniqueValidateConfigurator(UniqueValidate <TEntity, TDbContext> validator) { this.validator = validator; }