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
コード例 #1
0
ファイル: SaveContact.cs プロジェクト: lulzzz/CommanderDemo
 public Handler(ContactDb db, AppContext appContext, IQueueService queue, IMediator mediator)
 {
     _db         = db;
     _appContext = appContext;
     _queue      = queue;
     _mediator   = mediator;
 }
コード例 #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);
        }
コード例 #3
0
 public Handler(ContactDb db)
 {
     _db = db;
 }
コード例 #4
0
 public Handler(ContactDb db, ITokenService tokenService)
 {
     _db           = db;
     _tokenService = tokenService;
 }