You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
57 lines
1.3 KiB
57 lines
1.3 KiB
4 weeks ago
|
using Microsoft.EntityFrameworkCore;
|
||
|
using System;
|
||
|
using System.Collections.Generic;
|
||
|
using System.Linq;
|
||
|
using System.Text;
|
||
|
using System.Threading.Tasks;
|
||
|
|
||
|
using Microsoft.EntityFrameworkCore.ChangeTracking;
|
||
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||
|
using Microsoft.EntityFrameworkCore.Metadata;
|
||
|
using System;
|
||
|
using Dapper;
|
||
|
using Models;
|
||
|
|
||
|
|
||
|
namespace WpfApp4
|
||
|
{
|
||
|
public class JobDbContext:DbContext
|
||
|
{
|
||
|
public JobDbContext(DbContextOptions<JobDbContext> options)
|
||
|
: base(options)
|
||
|
{
|
||
|
}
|
||
|
public JobDbContext()
|
||
|
{
|
||
|
this.Database.SetCommandTimeout(System.TimeSpan.FromMinutes(50));
|
||
|
}
|
||
|
public JobDbContext(string strConn)
|
||
|
{
|
||
|
this.Database.SetCommandTimeout(System.TimeSpan.FromMinutes(50));
|
||
|
}
|
||
|
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||
|
{
|
||
|
// 配置数据库连接字符串
|
||
|
optionsBuilder.UseSqlServer(App.HangfireConfig.ConnectionString);
|
||
|
}
|
||
|
public DbSet<Logs> Log { set; get; }
|
||
|
// 配置实体映射
|
||
|
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||
|
{
|
||
|
base.OnModelCreating(modelBuilder);
|
||
|
|
||
|
|
||
|
// 配置表名
|
||
|
|
||
|
|
||
|
// 其他配置...
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
}
|
||
|
}
|