1、创建项目
我们以 console 类型项目试验 插入、删除、更新、查询 等功能,创建控制台项目,使用命令:
dotnet new console

dotnet add package FreeSql.Provider.Sqlite
dotnet add package FreeSql.Repository

2、创建实体模型
using System;
using FreeSql.DataAnnotations;
public class User
{
[Column(IsIdentity = true)]
public long Id { get; set; }
public string UserName { get; set; }
public string PassWord { get; set; }
public DateTime CreateTime { get; set; }
}
3、初始化 ORM
static IFreeSql fsql = new FreeSql.FreeSqlBuilder()
.UseConnectionString(FreeSql.DataType.Sqlite, "data source=test.db")
.UseMonitorCommand(cmd => Trace.WriteLine($"线程:{cmd.CommandText}\r\n"))
.UseAutoSyncStructure

本文介绍了如何在 .Net Framework, .Net Core 和 Xamarin 平台上利用 ORM FreeSql 进行 SQLite 数据库的增删查改操作。详细步骤包括创建项目、定义实体模型、初始化 ORM,以及具体的 CRUD 操作。文章还提及 FreeSql 支持多种数据库,并提供了源码地址。"
88320967,8325639,使用Selenium进行Web自动化模拟登录,"['Web开发', '自动化测试', 'Selenium', 'Python库', '浏览器模拟']
最低0.47元/天 解锁文章
797

被折叠的 条评论
为什么被折叠?



