FreeSql

官网  
实体特性 
Ado 它包括所有对 SQL 操作的封装,提供 ExecuteReader、ExecuteDataSet、ExecuteDataTable、ExecuteNonQuery、ExecuteScalar 等方法,使用起来和传统 SqlHelper 一样。

1、安装包

dotnet add package FreeSql
dotnet add package FreeSql.Provider.SqlServer-- 仓储
dotnet add package FreeSql.DbContext

2、Program.cs 文件

using FreeSql;
using Microsoft.OpenApi.Models;
using System.Configuration;var builder = WebApplication.CreateBuilder(args);builder.Services.AddControllers();#region FreeSqlFunc<IServiceProvider, IFreeSql> fsqlFactory = r =>
{IFreeSql fsql = new FreeSqlBuilder().UseConnectionString(DataType.SqlServer, builder.Configuration.GetConnectionString("SqlServerDefault"))//.UseConnectionString(FreeSql.DataType.SqlServer, r.GetService<IConfiguration>()["ConnectionStrings:Default"]).UseMonitorCommand(cmd => Console.WriteLine($"Sql:{cmd.CommandText}"))//监听SQL语句//.UseAutoSyncStructure(true) //自动同步实体结构到数据库,FreeSql不会扫描程序集,只有CRUD时才会生成表。.UseLazyLoading(false).UseNoneCommandParameter(true).Build();return fsql;
};
/// 仓储
builder.Services.AddFreeRepository();
builder.Services.AddScoped<UnitOfWorkManager>();builder.Services.AddSingleton(fsqlFactory);#endregionvar app = builder.Build();// Configure the HTTP request pipeline.app.UseAuthorization();//在项目启动时,从容器中获取IFreeSql实例,并执行一些操作:同步表,种子数据,FluentAPI等
using (IServiceScope serviceScope = app.Services.CreateScope())
{var fsql = serviceScope.ServiceProvider.GetRequiredService<IFreeSql>();//fsql.CodeFirst.SyncStructure(typeof(Topic));//Topic 为要同步的实体类//同步实体类到数据库
}app.MapControllers();app.Run();

3、appsettings.json 文件

{"ConnectionStrings": {"SqlServerDefault": "data source=.;initial catalog=dbTest;uid=sa;password=000000;TrustServerCertificate=True;","Default": "Data Source=localhost;Port=3306;Database=dbTest;uid=root;pwd=1q2w3E*;charset=utf8mb4;Allow User Variables=true;AllowLoadLocalInfile=true;MinimumPoolSize=50;MaximumPoolSize=1000","DbType": "MySql"},"AllowedHosts": "*"
}

4、FreeSqlController.cs 文件

using CodeFirst.Entity;
using Microsoft.AspNetCore.Mvc;namespace Trial.WebAPI.Controllers
{[Route("api/FreeSql/[action]")][ApiController]public class FreeSqlController : ControllerBase{private readonly IFreeSql _fsql;public FreeSqlController(IFreeSql freeSql){_fsql = freeSql;}/// <summary>/// 单条插入/// </summary>/// <returns></returns>[HttpGet]public IActionResult Insert(){var model = new Transfer_Amount_Relation_copy2_FreeSql{UserName = "UserName",ActualPaymentFee = 100,Recipient = "Recipient",BankCardNumber = "BankCardNumber",IDNumber = "IDNumber",PaymentTime = DateTime.Now,OrderNo = "OrderNo",InputDetailId = 1,BigAmountId = 1,UsageAmount = 10};/// 返回即将执行的 SQL 语句string sqlString = _fsql.Insert(model).ToSql();/// 返回插入后的记录List<Transfer_Amount_Relation_copy2_FreeSql> t1 = _fsql.Insert(model).ExecuteInserted();/// 返回影响的行数int t2 = _fsql.Insert(model).ExecuteAffrows();/// 返回自增/// 表有自增列,插入数据后应该要返回 idlong id = _fsql.Insert(model).ExecuteIdentity();return Ok(new { data = model });}/// <summary>/// 批量插入/// </summary>/// <returns></returns>[HttpGet]public IActionResult BulkCopy(){var items = new List<Transfer_Amount_Relation_copy2_FreeSql>();for (int i = 0; i < 10; i++){items.Add(new Transfer_Amount_Relation_copy2_FreeSql{UserName = "UserName" + i.ToString(),ActualPaymentFee = 100,Recipient = "Recipient" + i.ToString(),BankCardNumber = "BankCardNumber" + i.ToString(),IDNumber = "IDNumber" + i.ToString(),PaymentTime = DateTime.Now,OrderNo = "OrderNo",InputDetailId = 1,BigAmountId = 1,UsageAmount = 10});}/// 批量插入 Affrowsint t = _fsql.Insert(items).ExecuteAffrows();/// 批量插入 SqlBulkCopy_fsql.Insert(items).ExecuteSqlBulkCopy();return Ok();}[HttpGet]public IActionResult SelectTest(){// 如果查询结果为空,ToOne方法会返回null,而不是抛出异常‌var toOne = _fsql.Select<Transfer_Amount_Relation_copy2_FreeSql>().Where(u => u.Id == 1000).ToOne();// 如果查询结果为空,First方法会抛出异常(经过测试,不会抛异常)var first = _fsql.Select<Transfer_Amount_Relation_copy2_FreeSql>().Where(u => u.Id == 1000).First();return Ok(new { data = toOne });}[HttpGet]public IActionResult PageTest(){long total = 0;decimal actualPaymentFee = 100;#region 分页1var page1 = _fsql.Select<Transfer_Amount_Relation_copy2_FreeSql>().WhereIf(actualPaymentFee > 0, x => x.ActualPaymentFee > 0).OrderBy(b => b.Id).Skip(0).Limit(10) //第100行-110行的记录.ToList();#endregion#region 分页2var page2 = _fsql.Select<Transfer_Amount_Relation_copy2_FreeSql>().Where(u => u.ActualPaymentFee > 0).OrderBy(u => u.ActualPaymentFee).Count(out total) //总记录数量.Page(1, 20).ToList();#endregion#region 分页3/// 数据量大一般不建议查 Count/CountAsync,而应该采用流式分页(上一页、下一页、不返回总数量)total = 0;var page3 = _fsql.Select<Transfer_Amount_Relation_copy2_FreeSql>().Where(u => u.ActualPaymentFee > 0).OrderBy(u => u.ActualPaymentFee);total = page3.Count();var list = page3.Page(1, 30).ToList();#endregionreturn Ok(new { data = list });}/// <summary>/// sql 语句/// </summary>/// <returns></returns>[HttpGet]public IActionResult WithSqlTest(){#region selectvar list = _fsql.Select<Transfer_Amount_Relation_copy2_FreeSql>().WithSql("select * from Transfer_Amount_Relation_copy2 where ActualPaymentFee > @val", new { val = 0 }).Page(1, 10).ToList();#endregion#region selectvar sql = "select top 10 * from Transfer_Amount_Relation_copy2";var list1 = _fsql.Ado.Query<Transfer_Amount_Relation_copy2_FreeSql>(sql).ToList();#endregion#region INSERTvar insertSql = "INSERT INTO [Transfer_Amount_Relation_copy2]" +"([UserName], [ActualPaymentFee], [Recipient], [BankCardNumber], [IDNumber], [OrderNo], [PaymentTime], [BigAmountId], [InputDetailId], [UsageAmount]) " +"VALUES" +"(@UserName, @ActualPaymentFee, @Recipient, @BankCardNumber, @IDNumber, @OrderNo, @PaymentTime, @BigAmountId, @InputDetailId, @UsageAmount)";var affectedRows = _fsql.Ado.ExecuteNonQuery(insertSql, new{UserName = "UserName100",ActualPaymentFee = 100,Recipient = "Recipient",BankCardNumber = "BankCardNumber",IDNumber = "IDNumber",OrderNo = "OrderNo",PaymentTime = DateTime.Now,BigAmountId = 1,InputDetailId = 1,UsageAmount = 10});#endregionreturn Ok(new { data = list });}/// <summary>/// sql 语句/// </summary>/// <returns></returns>[HttpGet]public IActionResult AdoTest(){#region 多条记录var list = _fsql.Ado.Query<Transfer_Amount_Relation_copy2>("select top 10 * from Transfer_Amount_Relation_copy2").ToList();#endregion#region 单条记录var model = _fsql.Ado.QuerySingle<Transfer_Amount_Relation_copy2>("select * from Transfer_Amount_Relation_copy2 where Id = @Id", new { Id = 50 });#endregion#region 多个结果集var sql1 = "select top 10 * from Transfer_Amount_Relation_copy2";var sql2 = "select top 20 * from Transfer_Amount_Relation_copy2";var result = _fsql.Ado.Query<Transfer_Amount_Relation_copy2, Transfer_Amount_Relation_copy2>($"{sql1};{sql2}");List<Transfer_Amount_Relation_copy2> list1 = result.Item1;List<Transfer_Amount_Relation_copy2> list2 = result.Item2;#endregion#region INSERTvar insertSql = "INSERT INTO [Transfer_Amount_Relation_copy2]" +"([UserName], [ActualPaymentFee], [Recipient], [BankCardNumber], [IDNumber], [OrderNo], [PaymentTime], [BigAmountId], [InputDetailId], [UsageAmount]) " +"VALUES" +"(@UserName, @ActualPaymentFee, @Recipient, @BankCardNumber, @IDNumber, @OrderNo, @PaymentTime, @BigAmountId, @InputDetailId, @UsageAmount)";var affectedRows = _fsql.Ado.ExecuteNonQuery(insertSql, new{UserName = "UserName100",ActualPaymentFee = 100,Recipient = "Recipient",BankCardNumber = "BankCardNumber",IDNumber = "IDNumber",OrderNo = "OrderNo",PaymentTime = DateTime.Now,BigAmountId = 1,InputDetailId = 1,UsageAmount = 10});#endregionreturn Ok(new { data = list });}}
}

================ 仓储 ================
5、SimpleFreeSqlRepository.cs 文件

using CodeFirst.Entity;
using FreeSql;namespace Trial.Repository.AmountRelation
{public interface ISimpleFreeSqlRepository{Task<long> Create(Transfer_Amount_Relation_copy2_FreeSql input);Task<long> Modify(Transfer_Amount_Relation_copy2_FreeSql input);Task<Transfer_Amount_Relation_copy2_FreeSql> GetAsync(long id);Task<List<Transfer_Amount_Relation_copy2_FreeSql>> GetPageList();/// <summary>/// WithSql/// </summary>/// <returns></returns>Task<List<Transfer_Amount_Relation_copy2_FreeSql>> GetPageListWithSql();}public class SimpleFreeSqlRepository : BaseRepository<Transfer_Amount_Relation_copy2_FreeSql>, ISimpleFreeSqlRepository{public SimpleFreeSqlRepository(IFreeSql fsql) : base(fsql) { }/// <summary>/// /// </summary>/// <param name="input"></param>/// <returns></returns>public async Task<long> Create(Transfer_Amount_Relation_copy2_FreeSql input){Transfer_Amount_Relation_copy2_FreeSql model = await InsertAsync(input);return model.Id;}/// <summary>/// /// </summary>/// <param name="input"></param>/// <returns></returns>public async Task<long> Modify(Transfer_Amount_Relation_copy2_FreeSql input){int count = await UpdateAsync(input);return count;}/// <summary>/// /// </summary>/// <param name="id"></param>/// <returns></returns>public async Task<Transfer_Amount_Relation_copy2_FreeSql> GetAsync(long id){var model = await Select.WhereDynamic(id).ToOneAsync<Transfer_Amount_Relation_copy2_FreeSql>();var model1 = Select.Where(x => x.Id == id).First();return model;}/// <summary>/// /// </summary>/// <returns></returns>public async Task<List<Transfer_Amount_Relation_copy2_FreeSql>> GetPageList(){var list = await Select.Where(u => u.ActualPaymentFee > 0).Where(x => x.Id > 0).OrderBy(x => x.Id).Skip(1).Take(100).ToListAsync();return list;}public async Task<List<Transfer_Amount_Relation_copy2_FreeSql>> GetPageListWithSql(){string sql = "select * from Transfer_Amount_Relation_copy2";var list = await Select.WithSql(sql).Where(x => x.Id > 0).OrderBy(x => x.Id).Skip(1).Take(100).ToListAsync();return list;}}
}

6、FreeSqlSimpleController.cs 仓储 

using CodeFirst.Entity;
using Microsoft.AspNetCore.Mvc;
using Trial.Repository.AmountRelation;namespace Trial.WebAPI.Controllers
{[Route("api/FreeSqlSimple/[action]")][ApiController]public class FreeSqlSimpleController : ControllerBase{private readonly ISimpleFreeSqlRepository _repository;/// <summary>/// /// </summary>/// <param name="repository"></param>public FreeSqlSimpleController(ISimpleFreeSqlRepository repository){_repository = repository;}/// <summary>/// /// </summary>/// <returns></returns>[HttpGet]public async Task<ActionResult> Get(){/// 插入long id = await _repository.Create(new Transfer_Amount_Relation_copy2_FreeSql{UserName = "UserName-FreeSql",ActualPaymentFee = 100,Recipient = "Recipient-FreeSql",BankCardNumber = "BankCardNumber-FreeSql",IDNumber = "IDNumber-FreeSql",PaymentTime = DateTime.Now,OrderNo = "OrderNo-FreeSql",InputDetailId = 1,BigAmountId = 1,UsageAmount = 10});/// 查询单条var model = await _repository.GetAsync(50);/// 分页var list = await _repository.GetPageList();/// 分页var withSqlList = await _repository.GetPageListWithSql();return Ok();}}
}

7、实体类   实体特性  

using FreeSql.DataAnnotations;namespace CodeFirst.Entity
{/// <summary>/// FreeSql/// </summary>[Table(Name = "Transfer_Amount_Relation_copy2")]public class Transfer_Amount_Relation_copy2_FreeSql{[Column(IsIdentity = true, IsPrimary = true)]public long Id { get; set; }/// <summary>/// 用户名/// </summary>public string UserName { get; set; }/// <summary>/// 实付费用/// </summary>public decimal ActualPaymentFee { get; set; }/// <summary>/// 收款人/// </summary>public string Recipient { get; set; }/// <summary>/// 银行卡号/// </summary>public string BankCardNumber { get; set; }/// <summary>/// 身份证号/// </summary>public string IDNumber { get; set; }/// <summary>/// 订单号/// </summary>public string OrderNo { get; set; }/// <summary>/// 支付时间/// </summary>public DateTime PaymentTime { get; set; }/// <summary>/// /// </summary>public int BigAmountId { get; set; }/// <summary>/// /// </summary>public int InputDetailId { get; set; }/// <summary>/// 使用金额/// </summary>public decimal UsageAmount { get; set; }}
}

==================== 仓储 abstract 抽象类 ====================
用于 仓储 扩展方法,自定义方法
创建自定义 IRepositoryBase.cs 接口文件,并且继承 FreeSql框架本身的 IBaseRepository 接口

using System;
using System.Linq.Expressions;
using FreeSql;namespace Trial.Repository.FreeSql
{public interface IRepositoryBase<TEntity, TKey> : IBaseRepository<TEntity, TKey> where TEntity : class{/// <summary>/// 获得Dto/// </summary>/// <typeparam name="TDto"></typeparam>/// <param name="id"></param>/// <returns></returns>Task<TDto> GetAsync<TDto>(TKey id);/// <summary>/// 根据条件获取实体/// </summary>/// <param name="exp"></param>/// <returns></returns>Task<TEntity> GetAsync(Expression<Func<TEntity, bool>> exp);/// <summary>/// 根据条件获取Dto/// </summary>/// <param name="exp"></param>/// <returns></returns>Task<TDto> GetAsync<TDto>(Expression<Func<TEntity, bool>> exp);/// <summary>/// 软删除/// </summary>/// <param name="id"></param>/// <returns></returns>Task<bool> SoftDeleteAsync(TKey id);/// <summary>/// 批量删除/// </summary>/// <param name="id"></param>/// <returns></returns>Task<bool> SoftDeleteAsync(TKey[] id);}public interface IRepositoryBase<TEntity> : IRepositoryBase<TEntity, long> where TEntity : class{}
}

创建自定义 RepositoryBase.cs 类文件,并且继承 FreeSql框架本身的 BaseRepository 类

using FreeSql;
using System.Linq.Expressions;namespace Trial.Repository.FreeSql
{public abstract class RepositoryBase<TEntity, TKey> : BaseRepository<TEntity, TKey> where TEntity : class, new(){protected RepositoryBase(UnitOfWorkManager uowm) : base(uowm.Orm){uowm.Binding(this);}/// <summary>/// 查询单条/// </summary>/// <typeparam name="TDto"></typeparam>/// <param name="id"></param>/// <returns></returns>public virtual Task<TDto> GetAsync<TDto>(TKey id){return Select.WhereDynamic(id).ToOneAsync<TDto>();}/// <summary>/// 根据条件获取实体/// </summary>/// <param name="exp"></param>/// <returns></returns>public virtual Task<TEntity> GetAsync(Expression<Func<TEntity, bool>> exp){return Select.Where(exp).ToOneAsync();}/// <summary>/// 根据条件获取Dto/// </summary>/// <typeparam name="TDto"></typeparam>/// <param name="exp"></param>/// <returns></returns>public virtual Task<TDto> GetAsync<TDto>(Expression<Func<TEntity, bool>> exp){return Select.Where(exp).ToOneAsync<TDto>();}public async Task<bool> SoftDeleteAsync(TKey id){await UpdateDiy.SetDto(new { IsDeleted = true }).WhereDynamic(id).ExecuteAffrowsAsync();return true;}public async Task<bool> SoftDeleteAsync(TKey[] ids){await UpdateDiy.SetDto(new { IsDeleted = true }).WhereDynamic(ids).ExecuteAffrowsAsync();return true;}}public abstract class RepositoryBase<TEntity> : RepositoryBase<TEntity, long> where TEntity : class, new(){protected RepositoryBase(UnitOfWorkManager uowm) : base(uowm){}}
}

*、AmountRelationFreeSqlRepository.cs 文件
因为继承了 FreeSql框架本身的 IBaseRepository 接口,可以直接使用InsertAsync,UpdateAsync,DeleteAsync 等方法,所以不用再自定义 增删改查 方法 

using CodeFirst.Entity;
using FreeSql;
using Trial.Repository.FreeSql;namespace Trial.Repository.AmountRelation
{/// <summary>/// 继承了基类/// </summary>public interface IAmountRelationFreeSqlRepository : IRepositoryBase<Transfer_Amount_Relation_copy2_FreeSql>{}public class AmountRelationFreeSqlRepository : RepositoryBase<Transfer_Amount_Relation_copy2_FreeSql>, IAmountRelationFreeSqlRepository{public AmountRelationFreeSqlRepository(UnitOfWorkManager uowm) : base(uowm){}}
}

*、FreeSqlAmountRelationController.cs 文件 

using CodeFirst.Entity;
using Microsoft.AspNetCore.Mvc;
using Trial.Repository.AmountRelation;namespace Trial.WebAPI.Controllers
{[Route("api/AmountRelationFreeSql/[action]")][ApiController]public class FreeSqlAmountRelationController : ControllerBase{private readonly IAmountRelationFreeSqlRepository _repository;public FreeSqlAmountRelationController(IAmountRelationFreeSqlRepository repository){_repository = repository;}[HttpGet]public async Task<ActionResult> Get(){var info = await _repository.InsertAsync(new Transfer_Amount_Relation_copy2_FreeSql{UserName = "UserName-FreeSql",ActualPaymentFee = 100,Recipient = "Recipient-FreeSql",BankCardNumber = "BankCardNumber-FreeSql",IDNumber = "IDNumber-FreeSql",PaymentTime = DateTime.Now,OrderNo = "OrderNo-FreeSql",InputDetailId = 1,BigAmountId = 1,UsageAmount = 10});int count = await _repository.UpdateAsync(new Transfer_Amount_Relation_copy2_FreeSql{Id = info.Id,UserName = "UserName-FreeSql-修改",ActualPaymentFee = 100,Recipient = "Recipient-FreeSql",BankCardNumber = "BankCardNumber-FreeSql",IDNumber = "IDNumber-FreeSql",PaymentTime = DateTime.Now,OrderNo = "OrderNo-FreeSql",InputDetailId = 1,BigAmountId = 1,UsageAmount = 10});/// 框架方法var result0 = await _repository.GetAsync(50);/// 自定义方法var result1 = await _repository.GetAsync<Transfer_Amount_Relation_copy2_FreeSql>(51);/// 自定义方法var result2 = await _repository.GetAsync(x => x.Id == 52);return Ok();}}
}

*
*
*
*
*
*

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/bicheng/65256.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

linux下搭建lamp环境(dvwa)

lamp简介 LAMP是指一组通常一起使用来运行动态网站或者服务器的自由软件名称首字母缩写&#xff1a; Linux&#xff0c;操作系统 Apache&#xff0c;网页服务器 MariaDB或MySQL&#xff0c;数据库管理系统或数据库服务器 PHP、Perl或Python&#xff0c;脚本语言 # ubuntu安装…

腾讯云云开发 Copilot 深度探索与实战分享

个人主页&#xff1a;♡喜欢做梦 欢迎 &#x1f44d;点赞 ➕关注 ❤️收藏 &#x1f4ac;评论 目录 一、引言 二、产品介绍 三、产品体验过程 四、整体总结 五、给开发者的复用建议 六、对 AI 辅助开发的前景展望 一、引言 在当今数字化转型加速的时代&#xff0c;…

潮玩设备AI语音交互方案,ESP32-S3芯片模组物联网通信技术

在智能化的世界里&#xff0c;每一个设备都是一个节点&#xff0c;它们通过无线网络相互连接&#xff0c;形成一个庞大的智能网络。这些设备能够相互通信&#xff0c;理解并判断用户的需求&#xff0c;从而提供更加个性化的服务。 而这一切的背后&#xff0c;是强大的处理器和…

Jensen-Shannon Divergence:定义、性质与应用

一、定义 Jensen-Shannon Divergence&#xff08;JS散度&#xff09;是一种衡量两个概率分布之间差异的方法&#xff0c;它是Kullback-Leibler Divergence&#xff08;KL散度&#xff09;的一种对称形式。JS散度在信息论、机器学习和统计学等领域中具有广泛的应用。 给定两个概…

使用 Three.js 创建烟花粒子特效教程

使用 Three.js 创建烟花粒子特效教程 今天&#xff0c;我们将使用 Three.js 来实现一个简单而美观的烟花粒子效果。烟花会在屏幕随机位置生成&#xff0c;粒子在爆炸后呈现出散射、下降、逐渐消散的动态效果。先来看一下效果。 第一步&#xff1a;搭建基础场景 在正式实现烟花…

神经网络-VggNet

2014年VggNet被推出&#xff0c;获取了ILSVRC2014比赛分类项目的第二名&#xff0c;第一名是GoogleNet&#xff0c;该网络在下节介绍&#xff0c;本节主要介绍VggNet。 VggNet可以称为是一个家族&#xff0c;根据层数的不同包括了A、A-LRN、B、C、D等网络结构&#xff0c;其中…

docker-compose搭建sfpt服务器

1. 搭建 创建sftp目录&#xff0c;进入该目录创建docker-compose.yml文件内容如下&#xff1a; version: 3.7services:sftp:image: atmoz/sftpcontainer_name: sftpports:- "122:22"volumes:- ./sftp-data:/homeenvironment:SFTP_USERS: "liubei:liubei161:10…

计算机视觉目标检测-1

文章目录 摘要Abstract1.目标检测任务描述1.1 目标检测分类算法1.2 目标定位的简单实现思路1.2.1 回归位置 2.R-CNN2.1 目标检测-Overfeat模型2.1.1 滑动窗口 2.2 目标检测-RCNN模型2.2.1 非极大抑制&#xff08;NMS&#xff09; 2.3 目标检测评价指标 3.SPPNet3.1 spatial pyr…

减速机润滑油的选用原则

减速机在投入运行前必须加入适当粘度的润滑油&#xff0c;须使齿轮间摩擦减小&#xff0c;遇高负荷及冲击负荷时&#xff0c;减速机才能充分发挥其机能。那么&#xff0c;应该如何选择减速机的润滑油呢&#xff1f; 1、粘度选择&#xff1a;粘度是齿轮油的一个重要理化指标&…

解线性方程组

直接三角分解&#xff08;LU分解&#xff0c;Doolittle分解&#xff09; ATM分解&#xff08;追赶法&#xff0c;Crout分解&#xff0c;克劳特分解&#xff09; 平方根法&#xff08;Cholesky分解&#xff0c;乔列斯基分解&#xff09; 矩阵的范数

使用 OpenCV 在图像中添加文字

在图像处理任务中&#xff0c;我们经常需要将文本添加到图像中。OpenCV 提供了 cv2.putText() 函数&#xff0c;可以很方便地在图像上绘制文本&#xff0c;支持多种字体、颜色、大小和位置等参数。 本文将详细介绍如何使用 OpenCV 在图像中添加文字&#xff0c;介绍 cv2.putTe…

HAL库STM32硬件IIC驱动数字电位器MCP4017

目录 一、芯片特性 二、硬件电路 三、工程搭建 四、IIC硬件地址 五、驱动程序 项目需要&#xff0c;最近用到了一个IIC接口的数字电位器&#xff0c;型号&#xff1a;MCP4017T-502E。对应阻值5K&#xff0c;使用STM32G030F6的硬件IIC驱动&#xff0c;发现简单的不得了&…

uni-app 中使用微信小程序第三方 SDK 及资源汇总

&#x1f380;&#x1f380;&#x1f380;uni-app 跨端开发系列 &#x1f380;&#x1f380;&#x1f380; 一、uni-app 组成和跨端原理 二、uni-app 各端差异注意事项 三、uni-app 离线本地存储方案 四、uni-app UI库、框架、组件选型指南 五、uni-app 蓝牙开发 六、uni-app …

17.2、应急事件场景与处理流程

目录 常见网络安全应急事件场景网络安全应急处理流程应急演练类型 常见网络安全应急事件场景 应急事件的处理场景&#xff0c;分成四类场景&#xff0c;恶意程序事件&#xff0c;网络攻击事件&#xff0c;还有网站相关的一些安全事件&#xff0c;最后是拒绝服务事件 恶意程序…

19_HTML5 Web Workers --[HTML5 API 学习之旅]

HTML5 Web Workers 是一种允许 JavaScript 在后台线程中运行的技术&#xff0c;从而不会阻塞用户界面或其他脚本的执行。通过使用 Web Workers&#xff0c;你可以执行复杂的计算任务而不影响页面的响应速度&#xff0c;提升用户体验。 Web Workers 的特点 Web Workers 是 HTM…

《解锁 Python 数据挖掘的奥秘》

《解锁 Python 数据挖掘的奥秘》 一、Python 数据挖掘基础&#xff08;一&#xff09;Python 基础与数据挖掘环境搭建&#xff08;二&#xff09;数据挖掘基本流程概述 二、Python 数据挖掘核心技术&#xff08;一&#xff09;数据收集与预处理技术&#xff08;二&#xff09;常…

爆改RagFlow

Rag理论概述 由近期 RAGFlow 的火爆看 RAG 的现状与未来 Ragflow解析参数说明 ♥ RagFlow源码解析 实际的文件解析通过接口 /v1/document/run 进行触发的&#xff0c;实际的处理是在 api/db/services/task_service.py 中的 queue_tasks() 中完成的&#xff0c;此方法会根据文件…

【GeekBand】C++设计模式笔记15_Proxy_代理模式

1. “接口隔离” 模式 在组件构建过程中&#xff0c;某些接口之间直接的依赖常常会带来很多问题&#xff0c;甚至根本无法实现。采用添加一层间接&#xff08;稳定&#xff09;接口&#xff0c;来隔离本来互相紧密关联的接口是一种常见的解决方案。典型模式 FacadeProxyAdapte…

springboot测试类里注入不成功且运行报错

目录 出错信息 原因 出错信息 写测试类的时候&#xff0c;一直说我注入不成功 而且我运行的时候报错了 java.lang.IllegalStateException: Unable to find a SpringBootConfiguration, you need to use ContextConfiguration or SpringBootTest(classes...) with your te…

Docker下TestHubo安装配置指南

TestHubo是一款开源免费的测试管理工具&#xff0c; 下面介绍Docker 私有部署的安装与配置。TestHubo 私有部署版本更适合有严格数据安全要求的企业&#xff0c;支持在本地或专属服务器上运行&#xff0c;以实现对数据和系统的完全控制。 1、Docker 服务端安装 Docker安装包下…