DataContext.cs
717 Bytes
using FreeSql;
using HHECS.DAQServer.Models;
namespace HHECS.DAQServer.DataAccess
{
/// <summary>
/// 数据库上下文
/// </summary>
/// <remarks>参考文档:<a href="https://freesql.net/guide/db-context.html">https://freesql.net/guide/db-context.html</a></remarks>
public class DataContext : DbContext
{
private readonly IFreeSql _freeSql;
public DataContext(IFreeSql freeSql)
{
_freeSql = freeSql;
}
public DbSet<EquipmentDataRecord> EquipmentDataRecord { get; set; } = null!;
protected override void OnConfiguring(DbContextOptionsBuilder options)
{
options.UseFreeSql(_freeSql);
}
}
}