예제 #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="UserRepository"/> class.
        /// </summary>
        /// <param name="config">The config<see cref="IConfiguration"/></param>
        public UserRepository(IConfiguration config)
        {
            DbContextOptionsBuilder <PlatoStationDbContext> builder = new DbContextOptionsBuilder <PlatoStationDbContext>();
            var options = builder.UseMySql(config.GetConnectionString("DefaultConnection"),
                                           mySqlOptions => mySqlOptions.ServerVersion(new ServerVersion(new Version(8, 0, 18), ServerType.MySql))
                                           ).Options;

            _context = new PlatoStationDbContext(options);
        }