分类 默认分类 下的文章

最新推荐

MinIO

  • 简介:MinIO 的 .NET 客户端,用于对接 S3 兼容对象存储(上传/下载、桶管理、预签名 URL 等)。
  • NuGet:dotnet add package Minio
  • 源码:https://github.com/minio/minio-dotnet

MQTTnet

  • 简介:高性能 MQTT 客户端/服务端库,支持 MQTT 3.1.1/5.0,常用于物联网消息通讯。
  • NuGet:dotnet add package MQTTnet
  • 源码:https://github.com/dotnet/MQTTnet

SonnetDB

  • 简介:SonnetDB是一个专为物联网和监控数据优化的高性能时序数据库,能高效存储和查询带时间戳的数据。
  • NuGet:dotnet add package SonnetDB
  • 源码:https://github.com/IoTSharp/SonnetDB

个人常用

Prism

  • 简介:模块化、MVVM 框架(WPF/MAUI 等),提供导航、依赖注入、事件聚合等基础设施。
  • NuGet:dotnet add package Prism.Wpf
  • 源码:https://github.com/PrismLibrary/Prism

FreeSql

  • 简介:轻量高性能 ORM,支持多数据库、多租户、代码优先/数据库优先、表达式查询等。
  • NuGet:dotnet add package FreeSql
  • 源码:https://github.com/dotnetcore/FreeSql

PropertyChanged.Fody

NLog

  • 简介:灵活的日志框架,支持多目标输出(文件/控制台/数据库/网络等)与丰富的布局配置。
  • NuGet:dotnet add package NLog
  • 源码:https://github.com/NLog/NLog

ReactiveUI

  • 简介:响应式 MVVM 框架,基于 Reactive Extensions 思想组织状态与事件流,适合复杂交互界面。
  • NuGet:dotnet add package ReactiveUI
  • 源码:https://github.com/reactiveui/ReactiveUI

MahApps.Metro.IconPacks

MiniExcel

gong-wpf-dragdrop

NetMQ

  • 简介:ZeroMQ 的 .NET 端口,用于高性能消息传递(pub/sub、req/rep、pipeline 等模式)。
  • NuGet:dotnet add package NetMQ
  • 源码:https://github.com/zeromq/netmq

NAudio

  • 简介:.NET 音频处理库,覆盖录音/播放、编解码、混音、Wave/MP3 等常见场景。
  • NuGet:dotnet add package NAudio
  • 源码:https://github.com/naudio/NAudio

Mapster

安装

Install-Package FreeSql.Repository

示例代码

static IFreeSql fsql = new FreeSql.FreeSqlBuilder()
    .UseConnectionString(FreeSql.DataType.MySql, connectionString)
    //Automatically synchronize the entity structure to the database.
    .UseAutoSyncStructure(true) 
    //Be sure to define as singleton mode
    .Build(); 

using (var uow = fsql.CreateUnitOfWork())
{
  var songRepo = fsql.GetRepository<Song>();
  var userRepo = fsql.GetRepository<User>();
  songRepo.UnitOfWork = uow; //Manually bind unit of work
  userRepo.UnitOfWork = uow;

  songRepo.Insert(new Song());
  userRepo.Update(...);

  uow.Orm.Insert(new Song()).ExecuteAffrows();
  //Note: uow.Orm and fsql are both IFreeSql
  //uow.Orm CRUD and uow are the same transaction (understood as temporary IFreeSql)
  //fsql CRUD and uow are not in the same transaction

  uow.Commit();
}

具体可参考:
https://github.com/dotnetcore/FreeSql/wiki/Unit-of-Work