PasteFormHelper 26.1.8
dotnet add package PasteFormHelper --version 26.1.8
NuGet\Install-Package PasteFormHelper -Version 26.1.8
<PackageReference Include="PasteFormHelper" Version="26.1.8" />
<PackageVersion Include="PasteFormHelper" Version="26.1.8" />
<PackageReference Include="PasteFormHelper" />
paket add PasteFormHelper --version 26.1.8
#r "nuget: PasteFormHelper, 26.1.8"
#:package PasteFormHelper@26.1.8
#addin nuget:?package=PasteFormHelper&version=26.1.8
#tool nuget:?package=PasteFormHelper&version=26.1.8
贴代码框架PasteForm简介
26.1.007
1.当前最后一个版本,后续的请引用PasteForm.Helper!!!
在日常开发中,特别是涉及到管理端页面的,你是否被大量的表单和表格而淹没,是否由于前后端的改动造成的版本差异而烦恼,是否为反复的修改而头疼,现在PasteForm可以解决你这个问题!
基于ABPvNext框架精简而来的案例项目PasteForm,里面包含了3个部分
1.ABPvNext框架本身,精简了不需要的其他模块,当然你也可以加回去,比如多租户,比如授权模块等
2.PasteForm贴代码框架,主要输出的是一个思想,就是基于Dto的特性实现大一统的CRUD操作
3.PasteBuilder针对这个框架而开发的代码生成器,你可以自定义自己的生成格式等,特别针对PasteForm中的Dto的特性做了优化
贴代码框架PasteForm主要的思路就是统一管理端,主要指网站的后台,基于Dto的特性,从而控制管理端页面的表单和表格,所以PasteForm是管理端表单和表格共舞的新篇章
PasteForm的源码地址在
https://gitee.com/pastecode/paste-template
下载源码后,你可以查阅PasteForm是如何工作的!
使用概述
大致流程就是管理端(前端,或者小程序端等,通过接受到Dto的属性和特性等信息,然后基于规则渲染UI,所以API和WEB端都需要改造,相对的Web端反而可以直接拿贴代码的来使用,接口端就需要基于实际情况进行改造了,不过放心这个改造不难!借助于PasteBuidler你甚至可以一键生成!!!)
如果只是引用贴代码框架的思想,那么你只要按照PasteForm的思想改造自己的项目即可 如果你的框架是ABPvNext的,有以下子项目
xxx.Application
xxx.Application.Contracts
xxx.Domain
xxx.EntiyFrameworkCore
xxx.HttpApi.Host
那么恭喜你,捡到宝了!
以下是案例项目的代码:
UserInfoAppService中获取不同Dto的接口
/// <summary>
/// 读取AddDto的数据模型
/// </summary>
/// <returns></returns>
[HttpGet]
[TypeFilter(typeof(RoleAttribute), Arguments = new object[] { "data", "add" })]
public PasteBuilderHelper.VoloModelInfo ReadAddModel()
{
var _model = PasteBuilderHelper.ReadModelProperty<UserInfoAddDto>(new UserInfoAddDto());
return _model;
}
/// <summary>
/// 读取UpdateDto的数据模型
/// </summary>
/// <returns></returns>
[HttpGet]
[TypeFilter(typeof(RoleAttribute), Arguments = new object[] { "data", "edit" })]
public async Task<PasteBuilderHelper.VoloModelInfo> ReadUpdateModel(int id)
{
var _info = await _dbContext.UserInfo.Where(x => x.Id == id).AsNoTracking().FirstOrDefaultAsync();
if (_info == null || _info == default)
{
throw new PasteCodeException("查询的信息不存在,无法执行编辑操作!");
}
var dto = ObjectMapper.Map<UserInfo, UserInfoUpdateDto>(_info);
var _query_gradeid = _dbContext.UserGrade.Where(x => x.UserId == _info.Id).Select(x => x.GradeId);
var grades = await _dbContext.GradeInfo.Where(x => _query_gradeid.Contains(x.Id)).AsNoTracking().ToListAsync();
if (grades != null && grades.Count > 0)
{
dto.Grades = ObjectMapper.Map<List<GradeInfo>, List<GradeInfoListDto>>(grades);
}
dto.PassWord = "";//密码只有重置,没有修改
var _dataModel = PasteBuilderHelper.ReadModelProperty<UserInfoUpdateDto>(dto);
return _dataModel;
}
/// <summary>
/// 读取UpdateDto的数据模型
/// </summary>
/// <returns></returns>
[HttpGet]
public async Task<PasteBuilderHelper.VoloModelInfo> ReadDetailModel(int id)
{
var _info = await _dbContext.UserInfo.Where(x => x.Id == id).AsNoTracking().FirstOrDefaultAsync();
if (_info == null || _info == default)
{
throw new PasteCodeException("查询的信息不存在,无法执行编辑操作!");
}
var dto = ObjectMapper.Map<UserInfo, UserInfoDto>(_info);
var _dataModel = PasteBuilderHelper.ReadModelProperty<UserInfoDto>(dto);
return _dataModel;
}
/// <summary>
/// 读取ListDto的数据模型
/// </summary>
/// <returns></returns>
[HttpGet]
public PasteBuilderHelper.VoloModelInfo ReadListModel()
{
var _model = PasteBuilderHelper.ReadModelProperty<UserInfoListDto>(new UserInfoListDto());
var _query_model = PasteBuilderHelper.ReadModelProperty(new InputQueryUserInfo());
if (_query_model != null)
{
_model.QueryProperties = _query_model.Properties;
}
return _model;
}
UserInfo的不同Dto对应的特性的写法
///<summary>
///用户信息
///</summary>
public class UserInfoAddDto
{
///<summary>
///邮箱
///</summary>
[MaxLength(64)]
[Required]
public string Email { get; set; } = "";
///<summary>
///密码
///</summary>
[MaxLength(64)]
[ColumnDataType("password")]
[Required]
public string PassWord { get; set; } = "";
///<summary>
///用户名
///</summary>
[MaxLength(32)]
[Required]
public string UserName { get; set; } = "";
///<summary>
///描述
///</summary>
[MaxLength(64)]
public string Desc { get; set; } = "";
///<summary>
///头像
///</summary>
[MaxLength(128)]
[ColumnDataType("image", "1", "head", "60*60")]
public string UserHead { get; set; } = "";
///<summary>
///状态
///</summary>
public bool IsEnable { get; set; } = true;
/// <summary>
/// 角色 包含的角色,这个暂未实现,应该会归纳到outers去
/// </summary>
[ColumnDataType("outers", "gradeInfo", "", "id", "name")]
public int[] GradeIds { get; set; }
}
///<summary>
///用户信息
///</summary>
public class UserInfoUpdateDto : EntityDto<int>
{
///<summary>
///邮箱
///</summary>
[MaxLength(64)]
[Required]
public string Email { get; set; } = "";
///<summary>
///密码
///</summary>
[MaxLength(64)]
[ColumnDataType("password")]
public string PassWord { get; set; } = "";
///<summary>
///用户名
///</summary>
[MaxLength(32)]
[Required]
public string UserName { get; set; } = "";
///<summary>
///描述
///</summary>
[MaxLength(64)]
public string Desc { get; set; } = "";
///<summary>
///头像
///</summary>
[MaxLength(128)]
[ColumnDataType("image", "1", "head", "60*60")]
public string UserHead { get; set; } = "";
///<summary>
///状态
///</summary>
public bool IsEnable { get; set; } = true;
/// <summary>
/// 角色 包含的角色,这个暂未实现,应该会归纳到outers去
/// </summary>
[ColumnDataType("outers", "gradeInfo", "grades", "id", "name")]
public int[] GradeIds { get; set; }
/// <summary>
/// 扩展 包含的角色列表
/// </summary>
[ColumnDataType("hidden")]
public List<GradeInfoListDto> Grades { get; set; }
}
///<summary>
///用户信息
///</summary>
public class UserInfoDto : EntityDto<int>
{
///<summary>
///用户名
///</summary>
public string UserName { get; set; }
///<summary>
///头像
///</summary>
public string UserHead { get; set; }
///<summary>
///创建日期
///</summary>
public DateTime CreateDate { get; set; }
///<summary>
///描述
///</summary>
public string Desc { get; set; }
///<summary>
///邮箱
///</summary>
public string Email { get; set; }
///<summary>
///密码
///</summary>
public string PassWord { get; set; }
///<summary>
///状态
///</summary>
public bool IsEnable { get; set; }
}
///<summary>
///用户信息
///</summary>
[ColumnDataType("disable", "", "", "del")]
public class UserInfoListDto : EntityDto<int>
{
///<summary>
///用户名
///</summary>
public string UserName { get; set; }
///<summary>
///头像
///</summary>
[PasteImage]
public string UserHead { get; set; }
///<summary>
///创建日期
///</summary>
public DateTime CreateDate { get; set; }
///<summary>
///描述
///</summary>
public string Desc { get; set; }
///<summary>
///邮箱
///</summary>
public string Email { get; set; }
/////<summary>
/////密码
/////</summary>
//public string PassWord { get; set; }
///<summary>
///状态
///</summary>
[ColumnDataType("switch")]
public bool IsEnable { get; set; }
}
///<summary>
///用户信息
///</summary>
public class UserShortModel
{
/// <summary>
///
/// </summary>
public int Id { get; set; }
///<summary>
///用户名
///</summary>
public string UserName { get; set; }
///<summary>
///头像
///</summary>
public string UserHead { get; set; }
/////<summary>
/////创建日期
/////</summary>
//public DateTime CreateDate { get; set; }
/////<summary>
/////描述
/////</summary>
//public string Desc { get; set; }
/////<summary>
/////邮箱
/////</summary>
//public string Email { get; set; }
/////<summary>
/////密码
/////</summary>
//public string PassWord { get; set; }
/////<summary>
/////状态
/////</summary>
//public bool IsEnable { get; set; }
}
///<summary>
/// 查询
///</summary>
public class InputQueryUserInfo : InputSearchBase
{
/// <summary>
/// 日期区间
/// </summary>
[ColumnDataType("daterange", "sdate", "edate")]
public DateTime? sdate { get; set; }
/// <summary>
/// 日期区间
/// </summary>
[ColumnDataType("hidden")]
public DateTime? edate { get; set; }
}
更多更详细的请到论坛查看
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net6.0
- No dependencies.
-
net8.0
- No dependencies.
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 |
|---|---|---|
| 26.1.8 | 94 | 1/17/2026 |
| 26.1.7 | 105 | 1/9/2026 |
| 26.1.6 | 98 | 1/8/2026 |
| 26.1.5 | 99 | 1/8/2026 |
| 26.1.4 | 91 | 1/8/2026 |
| 26.1.3 | 92 | 1/8/2026 |
| 26.1.2 | 99 | 1/5/2026 |
| 26.1.1 | 94 | 1/4/2026 |
| 25.11.3 | 178 | 11/27/2025 |
| 25.11.2 | 182 | 11/26/2025 |
| 25.11.1 | 204 | 11/9/2025 |
| 25.10.3 | 146 | 10/26/2025 |
| 25.10.2 | 177 | 10/16/2025 |
| 25.10.1 | 174 | 10/9/2025 |
| 25.9.5 | 177 | 10/8/2025 |
| 25.9.4 | 163 | 9/26/2025 |
| 25.9.2 | 313 | 9/17/2025 |
| 25.9.1 | 179 | 9/11/2025 |
| 25.8.11 | 175 | 8/31/2025 |
| 25.8.9 | 318 | 8/25/2025 |
享受Dto特性驱动管理端的乐趣吧!https://soft.pastecode.cn/doc/form/