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
Exemple #1
0
 public Handler(ContactDb db, AppContext appContext, IQueueService queue, IMediator mediator)
 {
     _db         = db;
     _appContext = appContext;
     _queue      = queue;
     _mediator   = mediator;
 }
        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);
        }
Exemple #3
0
 public Handler(ContactDb db)
 {
     _db = db;
 }
Exemple #4
0
 public Handler(ContactDb db, ITokenService tokenService)
 {
     _db           = db;
     _tokenService = tokenService;
 }