Example #1
0
        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();
        }
Example #2
0
 public UserRepository(CommandsDbContext commandsContext, QueriesDbContext queriesContext)
 {
     _commandsContext = commandsContext ?? throw new ArgumentNullException(nameof(commandsContext));
     _queriesContext  = queriesContext ?? throw new ArgumentNullException(nameof(queriesContext));
 }
Example #3
0
 public PlatformsController(CommandsDbContext context, IMapper mapper)
 {
     _context = context;
     _mapper  = mapper;
 }