We keep our models and database as internal because *everything* is only ever exposed via the command view models. We're also going to tell EntityFramework to use our MigrationsConfig which configures AutomaticMigrations to keep our db schema in sync with our model changes automatically on app startup.
Inheritance: DbContext
Ejemplo n.º 1
0
 public Handler(ContactDb db, AppContext appContext, IQueueService queue, IMediator mediator)
 {
     _db         = db;
     _appContext = appContext;
     _queue      = queue;
     _mediator   = mediator;
 }
Ejemplo n.º 2
0
        public TestSaveContact()
        {
            var contacts = new[]
            {
                new Contact
                {
                    Id = 1,
                    FirstName = "First",
                    LastName = "Last",
                    Email = "*****@*****.**",
                    PhoneNumber = "555-1212"
                },
            }.ToDbSet();

            _db = A.Fake<ContactDb>();
            A.CallTo(() => _db.Contacts).Returns(contacts);

            _appContext = A.Fake<AppContext>();
            _queue = A.Fake<IQueueService>();
            _mediator = A.Fake<IMediator>();

            _handler = new SaveContact.Handler(_db, _appContext, _queue, _mediator);
        }
Ejemplo n.º 3
0
 public Handler(ContactDb db)
 {
     _db = db;
 }
Ejemplo n.º 4
0
 public Handler(ContactDb db, ITokenService tokenService)
 {
     _db           = db;
     _tokenService = tokenService;
 }