ConfigContext.cs
2.0 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
using DeviceLib.Model.AGV;
using SQLite.CodeFirst;
using System.Data.Entity;
namespace DeviceLib.DB.Config
{
public class ConfigContext : DbContext
{
/// <summary>
/// 机器人集合
/// </summary>
public DbSet<Robot> Robots { get; set; }
public DbSet<RobotType> RobotTypes { get; set; }
/// <summary>
/// 节点集合
/// </summary>
public DbSet<ClientNode> Nodes { get; set; }
/// <summary>
/// 任务集合
/// </summary>
public DbSet<Mission> Missions { get; set; }
/// <summary>
/// 订单集合
/// </summary>
public DbSet<Order> Orders { get; set; }
public DbSet<OrderState> OrderStates { get; set; }
public DbSet<OrderType> OrderTypes { get; set; }
/// <summary>
/// Fleet集合
/// </summary>
public DbSet<Fleet> Fleets { get; set; }
public DbSet<User> Users { get; set; }
/// <summary>
/// 负载信息
/// </summary>
public DbSet<LoadInfo> LoadInfos { get; set; }
public DbSet<MissionGroup> MissionGroups { get; set; }
public DbSet<MissionType> MissionTypes { get; set; }
public DbSet<Workshop> Workshops { get; set; }
public DbSet<Elevator> Elevators { get; set; }
public DbSet<IOModule> IOModules { get; set; }
//protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
//{
// if (!optionsBuilder.IsConfigured)
// {
// string connectionStr = "Data Source=./config/agv_data.db";
// optionsBuilder.UseSqlite(connectionStr);
// }
//}
public ConfigContext() : base("ORMContext") { }
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
var sqliteConnectionInitializer = new SqliteCreateDatabaseIfNotExists<ConfigContext>(modelBuilder);
Database.SetInitializer(sqliteConnectionInitializer);
}
}
}