搜索引擎优化seo网站群晖wordpress英文
- 作者: 五速梦信息网
- 时间: 2026年04月20日 08:25
当前位置: 首页 > news >正文
搜索引擎优化seo网站,群晖wordpress英文,seo资料站,电子商城网站制作目录 零、官网链接 一、字段映射表 二、查询 1.freesql独特封装#xff1a;between关键字 2.分页#xff08;每页 20 条数据#xff0c;查询第 1 页#xff09; 3.Withsql#xff08;子查询#xff0c;不建议#xff09; 3.简单查询、映射查询 4.参数查询、自定义…目录 零、官网链接 一、字段映射表 二、查询 1.freesql独特封装between关键字 2.分页每页 20 条数据查询第 1 页 3.Withsql子查询不建议 3.简单查询、映射查询 4.参数查询、自定义查询 5.左外连接框架导航属性 6.简单分表查询 三、增删改 1.SQL增删改 2.框架增删改普通 3.框架保存逻辑 四、demo 1.Model 2.Main 零、官网链接 https://freesql.net/guide/ 一、字段映射表 访问官网 二、查询 1.freesql独特封装between关键字查日期 var list list.Where(a a.Time.Between(time1, time2)); 2.分页每页 20 条数据查询第 1 页 var list fsql.SelectTopic().Where(a a.Id 10).Count(out var total) //总记录数量.Page(1, 20).ToList();3.Withsql子查询不建议 class Topic {[Column(IsIdentity true)]public int Id { get; set; }public string Title { get; set; }public int Clicks { get; set; }public DateTime CreateTime { get; set; }public int CategoryId { get; set; } }fsql.SelectTopic().WithSql(select * from Topic where clicks val, new { val 10 }).Page(1, 10).ToList() //SELECT a.Id, a.Clicks, a.CategoryId, a.Title, a.CreateTime //FROM (select * from Topic where clicks val) a 3.简单查询、映射查询 【技巧】打印sql、纠正映射 ListStudent2022 list1 freesql.SelectStudent2022().ToList(); //1.简单查询//var sql1 freesql.SelectStudent2022().ToSql();//【技巧】获取查询SQLListStuAndParent list5 freesql.SelectStudent2022().ToListStuAndParent();//2.查询后自动映射 //freesql.SelectStudent2022().ToList(x new StuAndParent { xxx x.id }) //【技巧】纠正映射 4.参数查询、自定义查询 //等于、批量in、模糊like查询 freesql.Ado.QuerySingleT(select * from t1 where id id, new { id 1 });//同时支持字典查询 freesql.Ado.QueryT(select * from t1 where name like name, new { name % searchText % });//同时支持字典查询 var ids new int[] { 1, 2, 3 }; ListT list freesql.Ado.QueryT(select * from t1 where id in ids, new { ids ids });//仅支持 Array 和 IList 类型ListStuAndParent list2 freesql.Ado.QueryStuAndParent(SELECT * FROM Student_2022 A LEFT JOIN Parent B ON A.idB.pid);//3.自定义SQL查询 5.左外连接框架导航属性 ListStuAndParent list2 freesql.Ado.QueryStuAndParent(SELECT * FROM Student_2022 A LEFT JOIN Parent B ON A.idB.pid);//3.自定义SQL查询ListStuAndParent list3 freesql.SelectStudent2022, Parent()//4.左外连接框架列出具体字段.LeftJoin(w w.t1.id w.t2.pid).ToList(w new StuAndParent{id w.t1.id,name w.t1.name,pid w.t2.pid,pname w.t2.pname});ListStuAndParent list3_1 freesql.SelectStudent2022, Parent()//5.左外连接框架,映射结果.LeftJoin(w w.t1.id w.t2.pid).ToList(xnew StuAndParent());ListStuAndParent list4 freesql.SelectStudent2022() //6.左外连接(导航属性).LeftJoinParent((student, parent) student.id parent.pid)//直接设置关联条件.ToList(xnew StuAndParent());//转化为StuAndParent实体 [Table(Name Student2022)]public class Student2022{[Column(IsPrimary true)]public int id { get; set; }public string name { get; set; }public int? ParentId { get; set; } // 【导航关联字段】数据库不需要设置外键但数据库必须要有这个字段[Navigate(nameof(ParentId))] // 设置导航属性指定【导航关联字段】public Parent Parent { get; set; } // 关联的 Parent 实体}public class Parent{[Column(IsPrimary true)]public int pid { get; set; }public string pname { get; set; }[Navigate(nameof(Student2022.ParentId))] // 设置导航属性指定【导航关联字段】public Student2022 Student { get; set; } // 关联的 Student2022 实体}public class StuAndParent{public int id { get; set; }public string name { get; set; }public int pid { get; set; }public string pname { get; set; }} 6.简单分表查询 //7.简单分表查询 var list6 freesql.SelectTeacher().ToList(); //假如是按月分表[Table(Name log{yyyyMM}, AsTable createtime2022-1-1(1 month))]注意①需包含log202201这张表 ②递增规律是一个月一次确保他们存在。 ③确保有字段createtime。[Table(Name Teacher{yyyy}, AsTable time2023-1-1(1 year))]public class Teacher{[Column(IsPrimary true)]public int id { get; set; }public DateTime time { get; set; }} 三、增删改 1.SQL增删改ADO.NET //8.sql增删改 bool b freesql.Ado.ExecuteNonQuery(DELETE FROM Student_2022 WHERE id 6)0; 2.框架增删改普通 //9.框架增删改 freesql.Insert(entity).ExecuteAffrows();freesql.UpdateT(entity); freesql.UpdateT().Set(a a.Title, 新标题).Set(a a.Time, DateTime.Now).Where(a a.Id 1)//过滤条件.ExecuteAffrows();freesql.DeleteT(entity).ExecuteAffrows(); freesql.DeleteT().Where(s s.Id 1).ExecuteAffrows(); 3.框架保存逻辑 【判断依据】主键存在改主键不存在增 //10.保存实体增加或修改 var entity new Student2022 { name 晓晓, id 6 }; bool b2 freesql.InsertOrUpdateStudent2022().SetSource(entity) .ExecuteAffrows()0; 四、demo 1.Model using FreeSql.DataAnnotations; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks;namespace FreesqlDemo {public class Model{}[Table(Name Student2022)]public class Student2022{[Column(IsPrimary true)]public int id { get; set; }public string name { get; set; }public int? ParentId { get; set; } // 【导航关联字段】数据库不需要设置外键但数据库必须要有这个字段[Navigate(nameof(ParentId))] // 设置导航属性指定【导航关联字段】public Parent Parent { get; set; } // 关联的 Parent 实体}public class Parent{[Column(IsPrimary true)]public int pid { get; set; }public string pname { get; set; }[Navigate(nameof(Student2022.ParentId))] // 设置导航属性指定【导航关联字段】public Student2022 Student { get; set; } // 关联的 Student2022 实体}public class StuAndParent{public int id { get; set; }public string name { get; set; }public int pid { get; set; }public string pname { get; set; }}//假如是按月分表[Table(Name log{yyyyMM}, AsTable createtime2022-1-1(1 month))]注意①需包含log202201这张表 ②递增规律是一个月一次确保他们存在。 ③确保有字段createtime。[Table(Name Teacher{yyyy}, AsTable time2023-1-1(1 year))]public class Teacher{[Column(IsPrimary true)]public int id { get; set; }public DateTime time { get; set; }} }2.Main using FreeSql; using System.Diagnostics; using System.Net.WebSockets; using System.Reflection.Metadata; using static FreeSql.Internal.GlobalFilter;namespace FreesqlDemo {public class Program{// 修正后的静态字段声明private static IFreeSql freesql new FreeSqlBuilder().UseMonitorCommand(cmd Trace.WriteLine($Sql{cmd.CommandText})).UseConnectionString(DataType.SqlServer, server DESKTOP-FTH2P3S; Database Test; Trusted_Connection SSPI;).Build();static void Main(string[] args){ListStudent2022 list1 freesql.SelectStudent2022().ToList(); //1.简单查询var sql1 freesql.SelectStudent2022().ToSql();//【技巧】获取查询SQLListStuAndParent list5 freesql.SelectStudent2022().ToListStuAndParent();//2.查询后自动映射//freesql.SelectStudent2022().ToList(a new StuAndParent { xxx a.ext }) //【技巧】纠正映射//等于、批量in、模糊like查询//freesql.Ado.QuerySingleT(select * from t1 where id id, new { id 1 });//同时支持字典查询//freesql.Ado.QueryT(select * from t1 where name like name, new { name % searchText % });//同时支持字典查询//var ids new int[] { 1, 2, 3 };//ListT list freesql.Ado.QueryT(select * from t1 where id in ids, new { ids ids });//仅支持 Array 和 IList 类型ListStuAndParent list2 freesql.Ado.QueryStuAndParent(SELECT * FROM Student_2022 A LEFT JOIN Parent B ON A.idB.pid);//3.自定义SQL查询ListStuAndParent list3 freesql.SelectStudent2022, Parent()//4.左外连接框架列出具体字段.LeftJoin(w w.t1.id w.t2.pid).ToList(w new StuAndParent{id w.t1.id,name w.t1.name,pid w.t2.pid,pname w.t2.pname});ListStuAndParent list3_1 freesql.SelectStudent2022, Parent()//5.左外连接框架.LeftJoin(w w.t1.id w.t2.pid).ToList(xnew StuAndParent());ListStuAndParent list4 freesql.SelectStudent2022() //6.左外连接(导航属性).LeftJoinParent((student, parent) student.id parent.pid)//直接设置关联条件.ToList(xnew StuAndParent());//转化为StuAndParent实体//7.简单分表查询var list6 freesql.SelectTeacher().ToList();//8.sql增删改bool b freesql.Ado.ExecuteNonQuery(DELETE FROM Student_2022 WHERE id 6)0;//9.框架增删改//freesql.Insert(entity).ExecuteAffrows();//freesql.UpdateT(entity);//freesql.UpdateT()// .Set(a a.Title, 新标题)// .Set(a a.Time, DateTime.Now)// .Where(a a.Id 1)//过滤条件// .ExecuteAffrows();//freesql.DeleteT(entity).ExecuteAffrows();//freesql.DeleteT()// .Where(s s.Id 1)// .ExecuteAffrows();//10.保存实体增加或修改var entity new Student2022 { name 晓晓, id 6 };bool b2 freesql.InsertOrUpdateStudent2022().SetSource(entity) .ExecuteAffrows()0;}} }
- 上一篇: 搜索引擎营销网站怎么做网站卖机床
- 下一篇: 搜索引擎优化网站排名面试网站开发
相关文章
-
搜索引擎营销网站怎么做网站卖机床
搜索引擎营销网站怎么做网站卖机床
- 技术栈
- 2026年04月20日
-
搜索引擎营销的模式有哪些哈尔滨seo优化科技
搜索引擎营销的模式有哪些哈尔滨seo优化科技
- 技术栈
- 2026年04月20日
-
搜索引擎营销案例有哪些seo网站推广报价
搜索引擎营销案例有哪些seo网站推广报价
- 技术栈
- 2026年04月20日
-
搜索引擎优化网站排名面试网站开发
搜索引擎优化网站排名面试网站开发
- 技术栈
- 2026年04月20日
-
搜索引擎有哪些网站宁波seo服务推广
搜索引擎有哪些网站宁波seo服务推广
- 技术栈
- 2026年04月20日
-
搜索引擎怎么收录网站网站建设开题报告论述
搜索引擎怎么收录网站网站建设开题报告论述
- 技术栈
- 2026年04月20日
