コード例 #1
0
        private async Task CreateProZeroDbContextAsync()
        {
            var optionsBuilder = new DbContextOptionsBuilder <ProZeroContext>()
                                 .UseSqlServer(SecretConfiguration.ConnectionString)
                                 .optionsBuilder;

            var dbContext = new ProZeroContext(optionsBuilder.Options ?? throw new Exception("Failed to create DbContext..."));

            _disposables.Add(dbContext);
            DbContext = dbContext;
        }
コード例 #2
0
 public ProZeroRepo(ProZeroContext dbContext, ILogger <ProZeroRepo> logger)
 {
     _dbContext = dbContext ?? throw new ArgumentNullException(nameof(dbContext));
     _logger    = logger ?? throw new ArgumentNullException(nameof(logger));
 }