You.DbMapper 1.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package You.DbMapper --version 1.0.0
                    
NuGet\Install-Package You.DbMapper -Version 1.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="You.DbMapper" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="You.DbMapper" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="You.DbMapper" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add You.DbMapper --version 1.0.0
                    
#r "nuget: You.DbMapper, 1.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package You.DbMapper@1.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=You.DbMapper&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=You.DbMapper&version=1.0.0
                    
Install as a Cake Tool

You.DbMapper

介绍

数据库操作层,泛型存储

软件架构

DM-M-R-V: 1)DM即DatabaseModel层,可由提供的自动生成工具类生成; 2)M即Mapper层,包含所有数据库表对应的sql操作的xml文件,保存在Mapper文件夹下,可由提供的自动生成工具类生成; 3) R即Respository仓储层,提供用户直接操作的辅助类,用户无需知晓底层数据库到底是什么样的,可由提供的自动生成工具类生成; 4)V即View层,也称为应用层,需要根据业务实际开发,引用时,需要将所使用的数据库类库进行引用,并引用以上三个类库,在启动函数中添加以下代码: | //路径初始化 PathManager.Init(); PathManager.IsUseMapperXMLFile = false;//mapper.xml文件作为嵌入的资源,可作为隐藏sql使用 //PathManager.IsUseMapperXMLFile = true;//mapper.xml文件生成时复制到输出目录,可后续进行更改,重启生效 //检测目标数据库是否存在,不存在则复制原始数据库文件到目标位置 if (!FileFolderHelper.IsFileExist(PathManager.AppConfigDbPath)) { string originalDbFilePath = System.IO.Path.Combine(PathManager.AppRoot, "Database\Sqlite\data.db"); if (FileFolderHelper.IsFileExist(originalDbFilePath)) { FileFolderHelper.Copy(originalDbFilePath, PathManager.AppConfigDbPath); } } | |--| alternate text is missing from this package README image

安装教程
  1. 新建.net项目,以sqlite为例,创建Database文件夹,添加data.db文件;

  2. 添加CommonUtils.dll, DatabaseService.dll, 以及lib目录下的SQLite.dll进行引用;

  3. 使用EntityMapperCreater.exe,对data.db文件进行解析生成;

    alternate text is missing from this package README image

  4. 创建DM层和Respository层,将生成的文件放到对应的层类库中,客户端项目对其进行引用即可

使用说明
  1. Mapper层的xml文件中包含的sql语句只是用于简单的增删改查,若需要更复杂的联表操作,需要手动修改Model,SQL,Respository等对应的字段以及操作方法;
  2. Mapper中的MethodId对应Repository中的DaoParametersEntity的methodId参数;
  3. 注意:DaoParametersEntity中parameters参数顺序需要按照SQL参数化的顺序,无需重复添加。
参与贡献
  1. Lockey.You创立初版
特技
  1. 使用 Readme_XXX.md 来支持不同的语言,例如 Readme_en.md, Readme_zh.md
  2. Gitee 官方博客 blog.gitee.com
  3. 你可以 https://gitee.com/explore 这个地址来了解 Gitee 上的优秀开源项目
  4. GVP 全称是 Gitee 最有价值开源项目,是综合评定出的优秀开源项目
  5. Gitee 官方提供的使用手册 https://gitee.com/help
  6. Gitee 封面人物是一档用来展示 Gitee 会员风采的栏目 https://gitee.com/gitee-stars/
Product Compatible and additional computed target framework versions.
.NET Framework net is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.14 151 6/16/2025
1.0.13 219 6/16/2025 1.0.13 is deprecated because it is no longer maintained.
1.0.0 254 6/13/2025

1.添加泛型缓存,支持资源模式和文件模式