添加了标识查询

This commit is contained in:
CortexCore
2023-07-03 02:34:01 +08:00
parent dd10fb59e5
commit 4967df927a
58 changed files with 2653 additions and 804 deletions

View File

@@ -0,0 +1,17 @@
using Microsoft.EntityFrameworkCore;
namespace BITKit;
public class SqlLiteContext<T> : DbContext where T : class
{
private const string _database = "Database";
public DbSet<T> context { get; private set; }
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
PathHelper.GetFolderPath(_database);
var path = PathHelper.GetPath(_database, $"{typeof(T).Name}.db");
var sql = $"Data Source={path}";
BIT4Log.Log<T>($"已创建数据库链接:{path}");
optionsBuilder.UseSqlite(sql);
}
}