| | |
| | | using Microsoft.EntityFrameworkCore; |
| | | using System; |
| | | using System.Configuration; |
| | | using System.Xml; |
| | | |
| | |
| | | { |
| | | public DbSet<RobotInfo> RobotInfo { get; set; } |
| | | public DbSet<HttpRequestRecord> HttpRequestRecord { get; set; } |
| | | |
| | | protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) |
| | | { |
| | | if (!optionsBuilder.IsConfigured) |
| | | { |
| | | // 使用从app.config中读取的连接字符串 |
| | | // 使用从 app.config 中读取的 MySQL 连接字符串 |
| | | var connectionString = ConfigurationManager.ConnectionStrings["DbModel"].ConnectionString; |
| | | optionsBuilder.UseSqlite(connectionString); |
| | | optionsBuilder.UseMySql(connectionString); |
| | | } |
| | | } |
| | | } |