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
using FLY.OBJComponents.Server;
using FLY.OBJComponents.Server.Model;
using FObjBase;
using SQLite;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FLY.Weight2.Server.Model
{
/// <summary>
/// 数据库 写操作
/// </summary>
public class HistoryDb
{
DbModel dbModel;
public BulkDbSQLite<Lc_Flow, Db_Flow> FlowBuffer;
public BufferError ErrorBuffer;
/// <summary>
///
/// </summary>
/// <param name="dBModel"></param>
public void Init(DbModel dBModel)
{
this.dbModel = dBModel;
FlowBuffer = new BulkDbSQLite<Lc_Flow, Db_Flow>();
FlowBuffer.Init(dBModel.TbFlow,
(lc) => Lc_AutoMapperProfile.Mapper.Map<Db_Flow>(lc),
(db) => Lc_AutoMapperProfile.Mapper.Map<Lc_Flow>(db)
);
ErrorBuffer = new OBJComponents.Server.BufferError();
ErrorBuffer.Init(dBModel.TbError);
}
public void AddFlow(
Lc_Flow flow
)
{
FlowBuffer.Add(flow);
}
public void AddFlowRange(IEnumerable<Lc_Flow> flows)
{
FlowBuffer.AddRange(flows);
}
}
}