public static void Initialize(CommandsDbContext context, IServiceProvider services) { context.Database.EnsureCreated(); var patronRepo = services.GetService(typeof(IPatronRepository)) as IPatronRepository; var patrons = new Collection <Patron>(); patrons.Add(PatronFactory.CreateFrom(new NewPatronData { FirstName = "First", LastName = "Last", Email = new Domain.Patron.ValueObjects.EmailAddress("*****@*****.**") })); foreach (var patron in patrons) { patronRepo.Add(patron); } context.SaveChanges(); }
public UserRepository(CommandsDbContext commandsContext, QueriesDbContext queriesContext) { _commandsContext = commandsContext ?? throw new ArgumentNullException(nameof(commandsContext)); _queriesContext = queriesContext ?? throw new ArgumentNullException(nameof(queriesContext)); }
public PlatformsController(CommandsDbContext context, IMapper mapper) { _context = context; _mapper = mapper; }