30 lines
815 B
C#
30 lines
815 B
C#
using Microsoft.EntityFrameworkCore;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using Microsoft.Extensions.Configuration;
|
|
|
|
namespace JiShe.CollectBus.EntityFrameworkCore
|
|
{
|
|
public class CollectBusDbContext : DbContext
|
|
{
|
|
private readonly IConfiguration _configuration;
|
|
|
|
|
|
private DbSet<Device> Devices { set; get; }
|
|
|
|
public CollectBusDbContext(IConfiguration configuration)
|
|
{
|
|
_configuration = configuration;
|
|
}
|
|
|
|
|
|
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
|
{
|
|
optionsBuilder.UseMySql(_configuration.GetConnectionString("Default"),ServerVersion.AutoDetect(_configuration.GetConnectionString("Default")));
|
|
}
|
|
}
|
|
}
|